the springwebapp registers a IComponentInstantiationListener that performs the injection when the object is being constructed. This is the wicket.injection.ComponentInjector. This class scans for annotations and injects them.
there is a thread here that explains why we did not go with setter-based injection
http://www.nabble.com/New-features-Wicket-1.2-t1310931.html#a3497221
now all that said, there is nothing stopping you from writing the code to scan for setters and injecting them, it should be trivial. remember, somehow you will have to say /which/ setters should be injected since there is no xml to configure this.
-Igor
On 4/22/06, Lasse Koskela <[EMAIL PROTECTED]> wrote:
Hi,
I've been looking into the Spring integration and I've gotten the
annotations stuff working alright (@SpringBean-tagged instance
variables getting injected upon object creation). However, I'd like to
be able to stay in the Java 1.4 world and I'm sure there is a way to
do injection without the annotations--it's Spring after all. I just
haven't figured out how--exposing a public setter for the
to-be-injected field doesn't seem to work?
For example, the following works:
public class LoginForm extends Form {
@SpringBean(name = "authenticator")
private Authenticator auth;
public LoginForm(String name) {
super(name, new CompoundPropertyModel(new LoginInfo()));
InjectorHolder.getInjector().inject(this);
add(new TextField("j_username"));
add(new PasswordTextField("j_password"));
}
}
But this doesn't:
public class LoginForm extends Form {
private Authenticator auth;
public void setAuthenticator(Authenticator authenticator) {
this.auth = authenticator;
}
public LoginForm(String name) {
super(name, new CompoundPropertyModel(new LoginInfo()));
InjectorHolder.getInjector().inject(this);
add(new TextField("j_username"));
add(new PasswordTextField("j_password"));
}
}
Is there a way to do setter-injection?
-Lasse-
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user