方法一:
通过xml文件中init-method &destroy-method属性来指定初始化方法和销毁方法。
方法二:
通过@Bean注解的initMethod和destroyMethod参数来实现指定初始化方法和销毁方法。
方法三:
通过继承InitializingBean和DisposableBean接口方式指定初始化方法和销毁方法。
nitializingBean和DisposableBean接口方式指定初始化方法和销毁方法
方法四:
使用js250中的@PostConstruct和@PreDestroy注解指定初始化方法和销毁方法。
@PostConstruct和@PreDestroy注解指定初始化方法和销毁方法。
方法五:
通过继承 BeanPostProcessor接口,在初始化方法前后,添加调用方法。