@configruation和@component注解和@PostConstruct

@configruation和@component注解的作用都是把配置类交給spring容器管理,然后通过@bean注解的方法动态代理,生成一个被spring容器管理的实例,相当于<bean id=""  class="url"></bean>

 

 

@configruation和@component注解和@PostConstruct

 

    被@PostConstruct修饰的方法会在服务器加载Servle的时候运行,并且只会被服务器执行一次。PostConstruct在构造函数之后执行,init()方法之前执行。PreDestroy()方法在destroy()方法执行执行之后执行

 

@configruation和@component注解和@PostConstruct