Unable to run play application using guice for dependency injcetionWhat is dependency injection?Inversion of Control vs Dependency InjectionWhy does one use dependency injection?trying to implement load schema using silhouette play 2.4 play-slick 1.0.0Error downloading and compiling play-mailer pluginScala play Guice injectionFailed running activator run after play-slick upgradeResteasy and Google Guice: how to use multiple @ApplicationPath and resource with @Injection?Persistence Layer Abstraction [Slick]Play and Guice Dependency Injection with Interface
What is more safe for browsing the web: PC or smartphone?
Why are condenser mics so much more expensive than dynamics?
What are the requirements for a river delta to form?
Which version of the Squat Nimbleness feat is correct?
Picking a theme as a discovery writer
What does のそ mean on this picture?
Guess the number game (Python)
How long does it take a postcard to get from USA to Germany?
Class Not Passing SObject By Reference
Copper as an adjective to refer to something made of copper
What is a precise issue with allowing getters?
How to say something covers all the view up to the horizon line?
Is throwing dice a stochastic or a deterministic process?
How did the Apollo guidance computer handle parity bit errors?
Why doesn't a particle exert force on itself?
Installing Debian 10, upgrade to stable later?
What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?
Python 3 - simple temperature program version 1.3
How to use awk to extract data from a file based on the content of another file?
Endgame puzzle: How to avoid stalemate and win?
Problem with estimating a sequence with intuition
As a GM, is it bad form to ask for a moment to think when improvising?
Pattern matching failed
Primes in a Diamond
Unable to run play application using guice for dependency injcetion
What is dependency injection?Inversion of Control vs Dependency InjectionWhy does one use dependency injection?trying to implement load schema using silhouette play 2.4 play-slick 1.0.0Error downloading and compiling play-mailer pluginScala play Guice injectionFailed running activator run after play-slick upgradeResteasy and Google Guice: how to use multiple @ApplicationPath and resource with @Injection?Persistence Layer Abstraction [Slick]Play and Guice Dependency Injection with Interface
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to run a play application where I have used guice for dependency injection.
My controller is as follows
import scala.concurrent.ExecutionContext
import javax.inject.Inject
import play.api.libs.json.Json
import play.api.mvc._
class MyControllers @Inject()(
service: MyService,
cc: MessagesControllerComponents)(implicit ec: ExecutionContext)
extends MessagesAbstractController(cc) {
def getAll(id: Int): Action[AnyContent] = Action.async implicit request =>
// code to fetch from service and return result
Similarly in my service I have dependency injected the DAO as
class MyService @Inject()(dao: MyDAO)(implicit ec: ExecutionContext)
// call to DB
My build.sbt file looks something like this
name := """service-application"""
version := "2.6.x"
scalaVersion := "2.12.7"
crossScalaVersions := Seq("2.11.12", "2.12.4")
libraryDependencies ++= Seq(
guice,
"com.typesafe.play" %% "play-slick" % "3.0.3",
"com.typesafe.play" %% "play-slick-evolutions" % "3.0.3",
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"com.h2database" % "h2" % "1.4.197",
"org.scalactic" %% "scalactic" % "3.0.5",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test,
"net.codingwell" %% "scala-guice" % "4.1.0",
"com.typesafe.slick" %% "slick-codegen" % "3.2.1",
"com.typesafe.slick" %% "slick-testkit" % "3.2.3" % Test,
specs2 % Test
)
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
routesGenerator := InjectedRoutesGenerator
However, now when I am trying to run the play application via the sbt shell using command
run
I get the error as
[IJ]sbt:service-application> run
[error] java.lang.RuntimeException: No main class detected.
[error] at scala.sys.package$.error(package.scala:27)
[error] (Compile / bgRun) No main class detected.
[error] Total time: 1 s
Could you please let me know what I am missing here ? Is it some kind of configuration that I am missing in the conf file ?
Thanks in advance !!!
scala dependency-injection playframework guice
|
show 1 more comment
I am trying to run a play application where I have used guice for dependency injection.
My controller is as follows
import scala.concurrent.ExecutionContext
import javax.inject.Inject
import play.api.libs.json.Json
import play.api.mvc._
class MyControllers @Inject()(
service: MyService,
cc: MessagesControllerComponents)(implicit ec: ExecutionContext)
extends MessagesAbstractController(cc) {
def getAll(id: Int): Action[AnyContent] = Action.async implicit request =>
// code to fetch from service and return result
Similarly in my service I have dependency injected the DAO as
class MyService @Inject()(dao: MyDAO)(implicit ec: ExecutionContext)
// call to DB
My build.sbt file looks something like this
name := """service-application"""
version := "2.6.x"
scalaVersion := "2.12.7"
crossScalaVersions := Seq("2.11.12", "2.12.4")
libraryDependencies ++= Seq(
guice,
"com.typesafe.play" %% "play-slick" % "3.0.3",
"com.typesafe.play" %% "play-slick-evolutions" % "3.0.3",
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"com.h2database" % "h2" % "1.4.197",
"org.scalactic" %% "scalactic" % "3.0.5",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test,
"net.codingwell" %% "scala-guice" % "4.1.0",
"com.typesafe.slick" %% "slick-codegen" % "3.2.1",
"com.typesafe.slick" %% "slick-testkit" % "3.2.3" % Test,
specs2 % Test
)
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
routesGenerator := InjectedRoutesGenerator
However, now when I am trying to run the play application via the sbt shell using command
run
I get the error as
[IJ]sbt:service-application> run
[error] java.lang.RuntimeException: No main class detected.
[error] at scala.sys.package$.error(package.scala:27)
[error] (Compile / bgRun) No main class detected.
[error] Total time: 1 s
Could you please let me know what I am missing here ? Is it some kind of configuration that I am missing in the conf file ?
Thanks in advance !!!
scala dependency-injection playframework guice
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Are you using the Play SBT plugin inproject/plugins.sbt? If so I think you need to enable the plugin:enablePlugins(playScala)in yourbuild.sbt. If not, maybe try the plugin.
– Lasf
Mar 23 at 6:39
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
1
Okay. For what it's worth I can tell from your sbt promptsbt:service-application>that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful[service-application] $prompt. If the plugin is not enabled, then you won't have a (hidden)mainclass as an application starting point. So I would focus my debugging efforts there.
– Lasf
Mar 23 at 7:14
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20
|
show 1 more comment
I am trying to run a play application where I have used guice for dependency injection.
My controller is as follows
import scala.concurrent.ExecutionContext
import javax.inject.Inject
import play.api.libs.json.Json
import play.api.mvc._
class MyControllers @Inject()(
service: MyService,
cc: MessagesControllerComponents)(implicit ec: ExecutionContext)
extends MessagesAbstractController(cc) {
def getAll(id: Int): Action[AnyContent] = Action.async implicit request =>
// code to fetch from service and return result
Similarly in my service I have dependency injected the DAO as
class MyService @Inject()(dao: MyDAO)(implicit ec: ExecutionContext)
// call to DB
My build.sbt file looks something like this
name := """service-application"""
version := "2.6.x"
scalaVersion := "2.12.7"
crossScalaVersions := Seq("2.11.12", "2.12.4")
libraryDependencies ++= Seq(
guice,
"com.typesafe.play" %% "play-slick" % "3.0.3",
"com.typesafe.play" %% "play-slick-evolutions" % "3.0.3",
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"com.h2database" % "h2" % "1.4.197",
"org.scalactic" %% "scalactic" % "3.0.5",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test,
"net.codingwell" %% "scala-guice" % "4.1.0",
"com.typesafe.slick" %% "slick-codegen" % "3.2.1",
"com.typesafe.slick" %% "slick-testkit" % "3.2.3" % Test,
specs2 % Test
)
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
routesGenerator := InjectedRoutesGenerator
However, now when I am trying to run the play application via the sbt shell using command
run
I get the error as
[IJ]sbt:service-application> run
[error] java.lang.RuntimeException: No main class detected.
[error] at scala.sys.package$.error(package.scala:27)
[error] (Compile / bgRun) No main class detected.
[error] Total time: 1 s
Could you please let me know what I am missing here ? Is it some kind of configuration that I am missing in the conf file ?
Thanks in advance !!!
scala dependency-injection playframework guice
I am trying to run a play application where I have used guice for dependency injection.
My controller is as follows
import scala.concurrent.ExecutionContext
import javax.inject.Inject
import play.api.libs.json.Json
import play.api.mvc._
class MyControllers @Inject()(
service: MyService,
cc: MessagesControllerComponents)(implicit ec: ExecutionContext)
extends MessagesAbstractController(cc) {
def getAll(id: Int): Action[AnyContent] = Action.async implicit request =>
// code to fetch from service and return result
Similarly in my service I have dependency injected the DAO as
class MyService @Inject()(dao: MyDAO)(implicit ec: ExecutionContext)
// call to DB
My build.sbt file looks something like this
name := """service-application"""
version := "2.6.x"
scalaVersion := "2.12.7"
crossScalaVersions := Seq("2.11.12", "2.12.4")
libraryDependencies ++= Seq(
guice,
"com.typesafe.play" %% "play-slick" % "3.0.3",
"com.typesafe.play" %% "play-slick-evolutions" % "3.0.3",
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"com.h2database" % "h2" % "1.4.197",
"org.scalactic" %% "scalactic" % "3.0.5",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test,
"net.codingwell" %% "scala-guice" % "4.1.0",
"com.typesafe.slick" %% "slick-codegen" % "3.2.1",
"com.typesafe.slick" %% "slick-testkit" % "3.2.3" % Test,
specs2 % Test
)
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
routesGenerator := InjectedRoutesGenerator
However, now when I am trying to run the play application via the sbt shell using command
run
I get the error as
[IJ]sbt:service-application> run
[error] java.lang.RuntimeException: No main class detected.
[error] at scala.sys.package$.error(package.scala:27)
[error] (Compile / bgRun) No main class detected.
[error] Total time: 1 s
Could you please let me know what I am missing here ? Is it some kind of configuration that I am missing in the conf file ?
Thanks in advance !!!
scala dependency-injection playframework guice
scala dependency-injection playframework guice
edited Mar 23 at 5:17
Chaitanya Waikar
asked Mar 23 at 4:30
Chaitanya WaikarChaitanya Waikar
1,629419
1,629419
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Are you using the Play SBT plugin inproject/plugins.sbt? If so I think you need to enable the plugin:enablePlugins(playScala)in yourbuild.sbt. If not, maybe try the plugin.
– Lasf
Mar 23 at 6:39
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
1
Okay. For what it's worth I can tell from your sbt promptsbt:service-application>that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful[service-application] $prompt. If the plugin is not enabled, then you won't have a (hidden)mainclass as an application starting point. So I would focus my debugging efforts there.
– Lasf
Mar 23 at 7:14
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20
|
show 1 more comment
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Are you using the Play SBT plugin inproject/plugins.sbt? If so I think you need to enable the plugin:enablePlugins(playScala)in yourbuild.sbt. If not, maybe try the plugin.
– Lasf
Mar 23 at 6:39
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
1
Okay. For what it's worth I can tell from your sbt promptsbt:service-application>that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful[service-application] $prompt. If the plugin is not enabled, then you won't have a (hidden)mainclass as an application starting point. So I would focus my debugging efforts there.
– Lasf
Mar 23 at 7:14
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Are you using the Play SBT plugin in
project/plugins.sbt? If so I think you need to enable the plugin: enablePlugins(playScala) in your build.sbt. If not, maybe try the plugin.– Lasf
Mar 23 at 6:39
Are you using the Play SBT plugin in
project/plugins.sbt? If so I think you need to enable the plugin: enablePlugins(playScala) in your build.sbt. If not, maybe try the plugin.– Lasf
Mar 23 at 6:39
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
1
1
Okay. For what it's worth I can tell from your sbt prompt
sbt:service-application> that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful [service-application] $ prompt. If the plugin is not enabled, then you won't have a (hidden) main class as an application starting point. So I would focus my debugging efforts there.– Lasf
Mar 23 at 7:14
Okay. For what it's worth I can tell from your sbt prompt
sbt:service-application> that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful [service-application] $ prompt. If the plugin is not enabled, then you won't have a (hidden) main class as an application starting point. So I would focus my debugging efforts there.– Lasf
Mar 23 at 7:14
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310621%2funable-to-run-play-application-using-guice-for-dependency-injcetion%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310621%2funable-to-run-play-application-using-guice-for-dependency-injcetion%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Everything looks fine to me, but still I was getting this error and hence I turned up to the Stackoverflow community to help me out
– Chaitanya Waikar
Mar 23 at 5:20
Are you using the Play SBT plugin in
project/plugins.sbt? If so I think you need to enable the plugin:enablePlugins(playScala)in yourbuild.sbt. If not, maybe try the plugin.– Lasf
Mar 23 at 6:39
@Lasf tried that too. Didn't get it running :(
– Chaitanya Waikar
Mar 23 at 7:11
1
Okay. For what it's worth I can tell from your sbt prompt
sbt:service-application>that it's not picking up the sbt plugin. Were the plugin properly enabled, you would see a colorful[service-application] $prompt. If the plugin is not enabled, then you won't have a (hidden)mainclass as an application starting point. So I would focus my debugging efforts there.– Lasf
Mar 23 at 7:14
ok. @Lasf let me try once more
– Chaitanya Waikar
Mar 23 at 7:20