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.
I am creating an intermediate class between CRUDController and my controllers. That said all my controllers extend MyCrudController which extend CRUDController :
Extended by :
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
I haven't understand a word of what is Guice, but the problem has something to do with it. Thanks for help.