Issue
I am new to spring and I wanted to ask whether or not it is possible to pass params to the init and destroy methods of a bean.
Thanks.
Solution
No, you can't. If you need parameters, you will have to inject them as fields beforehand.
Sample Bean
public class Foo{
@Autowired
private Bar bar;
public void init(){
bar.doSomething();
}
}
Sample XML:
<bean class="Foo" init-method="init" />
Answered By - Sean Patrick Floyd
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)