Just inject the secondBean into your toolBean... No need to access the applicationContext.
Just create a setter on your toolBean:
Code:
public class ToolBean {
private SecondBean secondBean
public void setSecondBean(SecondBean secondBean) {
this.secondBean=secondBean;
}
public void doSomething() {
this.secondBean.someMethod();
}
}
Add a little something to your config
Code:
<bean id="toolBean" class="test.ToolBean">
<property name="secondBean"><ref local="secondBean"></property>
</bean>
And your all set.
See the spring reference and examples for more info.