@PostConstruct,@PreDestroy注解的使用说明
@PostConstruct,@PreDestroy注解都是java的原生注解,在javax.annotation包下。
@PostConstruct注解
@PostConstruct该注解被用来修饰一个非静态的void()方法。被@PostConstruct修饰的方法会在服务器加载Servlet的时候运行,并且只会被服务器执行一次。PostConstruct在构造函数之后执行,init()方法之前执行。
通常我们会是在Spring框架中使用到@PostConstruct注解 该注解的方法在整个Bean初始
转载
2020-07-22 16:52:34 ·
552 阅读 ·
0 评论