當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法
生活随笔
收集整理的這篇文章主要介紹了
通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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 的構造方法");}@PostConstructpublic void init() {System.out.println("book 的PostConstruct標志的方法");}@PreDestroypublic void destory() {System.out.println("book 的PreDestory標注的方法");}
}
?
總結
以上是生活随笔為你收集整理的通过JSR250规范 提供的注解@PostConstruct 和@ProDestory标注的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 什么是bean的生命周期?
- 下一篇: 通过Spring的BeanPostPro