三种初始化方式
public class Cat {
	@PostConstruct//初始化
	public void afterPropertiesSet() throws Exception {
		System.out.println(" cat init");
		
	}
	@PreDestroy//销毁
	public void destroy() throws Exception {
		System.out.println("cat destroy");
		
	}
}
public class User implements InitializingBean,DisposableBean{
	public String toString() {
		return "444";
		
	}
	@Override//初始化
	public void afterPropertiesSet() throws Exception {
		System.out.println(" user afterPropertiesSet");
		
	}
	@Override//销毁
	public void destroy() throws Exception {
		System.out.println("user destroy");
		
	}
}
public class Room {
        //初始化
	public void afterPropertiesSet() throws Exception {
		System.out.println(" room afterPropertiesSet");
		
	}
        //销毁
	public void destroy() throws Exception {
		System.out.println("room destroy");
		
	}
}
@Configuration
public class Cfg1 {
	@Bean
	public Cat getCat() {
		return new Cat();
	}
	@Bean
	public User getUser() {
		return new User();
	}
	
	@Bean(initMethod="afterPropertiesSet",destroyMethod="destroy")
	public Room getRoom() {
		return new Room();
	}
	
}