67,541
社区成员
发帖
与我相关
我的任务
分享
<bean id="knight" class="com.springinaction.knights.BraveKnight" init-method="init" destroy-method="destroy">
</bean>
public class BraveKnight implements Knight{
private void init(){
System.out.println("bean init");
}
private void destroy(){//never be invoked?
System.out.println("bean destroied");
}
}
ApplicationContext context=new ClassPathXmlApplicationContext("knights.xml");
Knight knight = (Knight) context.getBean("knight");
