In my web spring application I create an instance with key word new
as following.
In my one of action class, following method exists.
publi
Another solution can be the use of @Component
like this:
@Component("myBean")
public class MyBean{
@Autowired
MyService service;
public void process(){
service.execute(); // this service instance has not initialized by Spring DI :( .service object is null.
}
}
And at your class where process()
is, you can Autowire like this:
@Autowired
MyBean b
public void process(){
b.process();
}