In my web spring application I create an instance with key word new as following. In my one of action class, following method exists.
new
publi
If you want to autowire programmatically, you can use:
private @Autowired AutowireCapableBeanFactory beanFactory; public void process() { MyBean obj = new MyBean(); beanFactory.autowireBean(obj); // obj will now have its dependencies autowired. }