當(dāng)前位置:
首頁(yè) >
前端技术
> javascript
>内容正文
javascript
通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法
生活随笔
收集整理的這篇文章主要介紹了
通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
package com.leon.testbeanlifecycle;import org.springframework.stereotype.Component;import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;//@Component
public class Book {public Book() {System.out.println("book 的構(gòu)造方法");}@PostConstructpublic void init() {System.out.println("book 的PostConstruct標(biāo)志的方法");}@PreDestroypublic void destory() {System.out.println("book 的PreDestory標(biāo)注的方法");}
}
?
總結(jié)
以上是生活随笔為你收集整理的通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 什么是bean的生命周期?
- 下一篇: 通过Spring的BeanPostPro