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?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to