IoC容器可以自动管理Bean的初始化和销毁方法,用到的就是@PostConstruct(构造后)和@PreDestory(销毁前)注解. @Service //@Scope("singleton")//默认单例模式 public class AlphaService { public AlphaService(){ System.out.println("实例化AlphaService"); } @PostConstruct public void init(){ System.out.p...