-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hello,
So far, I've been using @WireVariable to inject Spring beans on my controllers and it's known to work perfectly.
@WireVariable("someBean")
private SomeBean someBean;
But here is my question... Is there a way to achieve the same result but with constructor injection? It's a known good practice to inject beans via constructor so it's easy to mock them on unit tests and such. Like this
private final SomeBean somebean;
public MyController(SomeBean someBean) {
this.somebean = someBean
}
Can this be achieved somehow or I simply cannot unit test a ZK Controller?
2 | No.2 Revision |
Hello,
So far, I've been using @WireVariable to inject Spring beans on my controllers and it's known to work perfectly.
@WireVariable("someBean")
private SomeBean someBean;
But here is my question... Is there a way to achieve the same result but with constructor injection? It's a known good practice to inject beans via constructor so it's easy to mock them on unit tests and such. Like this
private final SomeBean somebean;
public MyController(SomeBean someBean) {
this.somebean = someBean
someBean;
}
Can this be achieved somehow or I simply cannot unit test a ZK Controller?