Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guice warning while extending CRUDController #42

Closed
gbersac opened this issue Jul 30, 2014 · 1 comment
Closed

Guice warning while extending CRUDController #42

gbersac opened this issue Jul 30, 2014 · 1 comment

Comments

@gbersac
Copy link
Contributor

gbersac commented Jul 30, 2014

I am creating an intermediate class between CRUDController and my controllers. That said all my controllers extend MyCrudController which extend CRUDController :

public abstract class MyCrudController<K, M extends BasicModel<K>> extends CRUDController<K, M>
{
    public MyCrudController(DAO<K, M> dao, Class<K> keyClass, Class<M> modelClass)
    {
        super(dao, Form.form(modelClass), keyClass,
                modelClass, 10, "id" + modelClass.getSimpleName());
        className = modelClass.getSimpleName();
        Logger.debug("className: " + className);
    }
}

Extended by :

public class UserCtr extends MyCrudController<Long, User>
{
    @Inject
    public UserCtr(models.UserDao dao)
    {
        super(dao, Long.class, User.class);
    }
}

Everythings work fine, except that I get the following error every time I restart the interface :

Note that the @Inject in the UserCtr must be present, otherwise, the application doesn't acknowledge the existence of UserCtr. Adding @Inject to the constructor of MyCrudController or UserDAO doesn't change anything

com.google.inject.ConfigurationException: Guice configuration errors:

1) No implementation for crud.MyCrudController was bound.
  while locating crud.MyCrudController

1 error
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:961)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
    at play.utils.inject.InjectAdapter.getInstance(InjectAdapter.java:34)
    at play.utils.crud.CRUDManager.getController(CRUDManager.java:59)
    at play.utils.crud.GlobalCRUDSettings.getControllerInstance(GlobalCRUDSettings.java:12)
    at play.utils.meta.cp.ClasspathScanningControllerRegistry.scanCrud(ClasspathScanningControllerRegistry.java:151)
    at play.utils.meta.cp.ClasspathScanningControllerRegistry.<init>(ClasspathScanningControllerRegistry.java:46)
    at play.utils.crud.CRUDManager.initialize(CRUDManager.java:45)
    at play.utils.crud.GlobalCRUDSettings.onStart(GlobalCRUDSettings.java:23)
    at play.core.j.JavaGlobalSettingsAdapter.onStart(JavaGlobalSettingsAdapter.scala:18)
    at play.api.GlobalPlugin.onStart(GlobalSettings.scala:203)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:88)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
    at play.api.Play$.start(Play.scala:87)
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:139)
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:112)
    at scala.Option.map(Option.scala:145)
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112)
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:110)
    at scala.util.Success.flatMap(Try.scala:200)
    at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:110)
    at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:102)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
    at scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1361)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[info] play - Application started (Dev)

I haven't understand a word of what is Guice, but the problem has something to do with it.
Thanks for help.

@proton5000
Copy link

I have the same problem. I can not solve it. Please help me. I am trying to update play framework 2.3.10 to 2.4.1 and got this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants