使用JSR250的@PostConstruct&@PreDestroy实现初始化和销毁
public class Cat { public Cat() { } @PostConstruct public void init() { System.out.println("init"); } @PreDestroy public void destroy() { System.out.println("destroy"); } }