Questions tagged [playframework-2.4]

Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

What's new in Play 2.4

538 questions
56
votes
2 answers

How to use a path relative to project root to H2 db-file configuration with Play Framework 2.4?

We're developing a Play 2.4 application (Java API). For dev purposes, we'd like to use a persistent H2 database with DB file path relative to the project root directory. In How to use a persistent H2 database in the Play Framework instead of…
Touko
  • 11,359
  • 16
  • 75
  • 105
45
votes
3 answers

Play 2.4: Form: could not find implicit value for parameter messages: play.api.i18n.Messages

I am new to Play framework and tried to mimic the helloworld sample in my local machine but I encountered an error: routes: # Home page GET / controllers.Application.index # Hello action GET /hello …
arjayads
  • 553
  • 1
  • 5
  • 17
37
votes
1 answer

Play Framework @routes.Assets.at Compilation Error

I'm using Play 2.4.0 and I've been trying to follow the tutorial from the main page: https://playframework.com/ which is for Play 2.3 and after solving a couple of issues regarding changes in the Ebean ORM from version 2.3 to 2.4, I'm stuck with the…
Daniel Romero
  • 1,581
  • 1
  • 20
  • 33
28
votes
1 answer

Play Framework 2.4 Writes[-A] vs OWrites[-A], Format[A] vs OFormat[A]. Purpose?

What's the difference between Writes[-A] and OWrites[-A] in PlayFramework Json library? I have used Writes[A] but I can't figure out what's the purpose of OWrites. The same question applies to Format[A] vs OFormat[A]. The source code can be found…
vicaba
  • 2,836
  • 1
  • 27
  • 45
25
votes
5 answers

PlayFramework 2.4.6 error 413 Request Entity Too Large

I am using PlayFramework 2.4.6, trying to upload a multipart file (size 18M) and the server returns the following error: For request 'POST /api/myEndpoint' [Request Entity Too Large] I have looked around and tried the following with out…
Gleeb
  • 10,773
  • 26
  • 92
  • 135
20
votes
2 answers

Caching an action in a multi-language website using Play Framework's Cached API

In order to cache actions per label and language for a given number of seconds, I wrote the following helper method (where label, is the name I give to my action): def cacheResponseFor(label: String, duration: Int)(action: EssentialAction) = { …
Peter
  • 7,020
  • 4
  • 31
  • 51
17
votes
4 answers

Play 2.4 - Display Ebeans SQL statement in logs

How to display SQL Statements in the log ? I'm using EBeans and it fails to insert for some reasons but I can't see what's the problem. I tried to edit my config to: db.default.logStatements=true and add this to logback.xml
Gonzague
  • 332
  • 3
  • 16
14
votes
1 answer

How to run code on startup in Play! framework 2.4

I im trying to print "Hello" to console on application start. Can You explain how to do it? What i tried myself: app/modules/HelloModule.scala: package modules import com.google.inject.AbstractModule trait Hello {} class MyHelloClass extends…
dziablo
  • 163
  • 1
  • 7
14
votes
5 answers

Play Framework 2.4 and IntelliJ Idea

I am trying to open a play 2.4 project in IntelliJ but since things have changed I don't know how to do this. In previous versions I could just run activator idea Or use the activator UI and click on generate intelliJ project, but in 2.4 the idea…
13
votes
1 answer

Guice, DI, and Unit Tests in Play 2.4

So I've been trying to figure this out on my own via documentation but I'm not getting anywhere. I've got some simple DI bindings setup in a service class that creates a repository object. Simple. However, when I run this in test mode, @Inject does…
Zarathuztra
  • 3,215
  • 1
  • 20
  • 34
13
votes
2 answers

Play 2.4: How do I disable routes file loading during unit tests?

Background: I am using Play 2.4 (Java) with InjectedRoutesGenerator and a Guice module to configure various dependencies. But during unit tests, the FakeApplication is trying to load all the Controllers from routes file through the injector and some…
bravo2
  • 693
  • 5
  • 13
13
votes
1 answer

Play 2.4 - How to avoid recreating the database pool connection after a code change?

Is there a way to avoid recreating the connection pool to an in-memory database when reloading after a code change? [info] - application - Shutting down connection pool. [info] - application - Creating Pool for datasource 'default' [info] -…
Thomas
  • 1,491
  • 13
  • 23
12
votes
1 answer

How to pass Messages when I inject MessageApi and use the I18nSupport Trait

My controller actions use a custom action that looks like: class ActionWithContext @Inject()(....) extends ActionBuilder[ContextAwareRequest] { def invokeBlock[A](request: Request[A], block: (ContextAwareRequest[A]) => …
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
12
votes
3 answers

Configuration depending on launch mode

Play can be launched in dev mode (via run), in production mode (via start) or in test mode. Is there a way to provide a different config file (conf/application.conf) depending on which mode it is launched in?
Reactormonk
  • 21,472
  • 14
  • 74
  • 123
11
votes
4 answers

Unknown Property in a return type

I am trying to use mapstruct in my Play 2.4 Java8 JPA project. Steps I have done: Added Dependency "org.mapstruct" % "mapstruct-jdk8" % "1.1.0.Beta1", "org.mapstruct" % "mapstruct-processor" % "1.1.0.Beta1" Model @Entity public class Employee…
singhakash
  • 7,891
  • 6
  • 31
  • 65
1
2 3
35 36