Autogenerated object not available in a lifecycle hook ? [message #1624251] |
Thu, 19 February 2015 17:15 |
Thomas Elskens Messages: 159 Registered: September 2014 Location: Brussels - Belgium |
Senior Member |
|
|
Hello,
I was trying out the @Creatable annotation for a loginmanager class, but it doesn't seem to work.
Before, I had a code like this :
//...
@PostContextCreate
public LifecycleRV manageLogin(UISynchronize sync, @FXMLLoader FXMLLoaderFactory factory, IDomainManager domainManager)
{
LoginManager manager = new LoginManager(logger) ;
return manager.showLogin(sync, factory, domainManager) ;
}
This worked, but I had to inject a lot of dependencies where they were not actually needed and pass them around, so I tried instead :
@Creatable
@Singleton
public class LoginManager
{
//...
@Inject
public LoginManager(Logger logger, UISynchronize sync, FXMLLoaderFactory factory, IDomainManager domainManager)
{
this.logger = logger ;
FxmlFactory = factory ;
this.sync = sync ;
this.domainManager = domainManager ;
}
And so, in the lifecycle hook, I now have :
@PostContextCreate
public LifecycleRV manageLogin(LoginManager loginManager)
{
return loginManager.showLogin() ;
}
But this does not work at all: the PostContextCreate simply doesn't get called any longer.
So my question is : can I use this kind of injection in a lifecycle hook ? Or am I doing something wrong ?
Regards,
Thomas Elskens
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03663 seconds