On Jul 23, 2008, at 3:27 PM, landry soules wrote:
Actually, if the class using userDAO doesn't extend Component, you
have to add InjectorHolder.getInjector().inject(this) in the
constructor of the calling class.
Hmm, this may be the path.
The class in question is just a utility class that initializes some
database values.
public class AppSetup {
ApplicationContext applicationContext = ((WicketApplication)
Application.get()).getContext();
IProtocolDAO protocolDAO =
ProtocolDAO.getFromApplicationContext(applicationContext);
public AppSetup(){
setupProtocols();
}
private setupProtocols(){
// Do stuff with protocolDAO here
}
}
Instantiating the above from my wicket application init does create
the proper data, etc.
If I change it as below, how should it be called to guarantee
injection of ProtocolDAO?
public class AppSetup {
@SpringBean(name = ProtocolDAO)
IProtocolDAO protocolDAO;
public AppSetup(){
setupProtocols();
}
private setupProtocols(){
// Do stuff with protocolDAO here
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]