方式三:使用JSR-250规范注解(@PostConstruct、@PreDestroy) 首先导入jsr-250的jar包相关依赖 <!-- https://mvnrepository.com/artifact/javax.annotation/jsr250-api --> <dependency> <groupId>javax.annotation</groupId> <artifactId>jsr250-api</artifactId> <version>1.0</version> </dependency> 1. 2. ...