21
SampleBean:@PostConstruct no se llama en la primavera
package com.springexample;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
public class SampleBean {
private BeanTypeOne beanOne;
private BeanTypeTwo beanTwo;
public void init() {
System.out.println("This is from the init() method");
}
@PostConstruct
public void initAnnotation() {
System.out.println("This is from the initAnnotation() method");
}
y configuración de archivos de esta manera:
<bean id="SampleBean" class="com.springexample.SampleBean">
<property name="beanOne" ref="beanOneOne"></property>
<property name="beanTwo" ref="beanTwoOne"></property>
</bean>
Y no tengo default-init-método conjunto de atributos en el beans etiqueta.
¿Puede alguien decir por qué no se llama al método @PostConstruct?
sí, está trabajando ahora .. Ya..Recuerdo que hace un tiempo me enteré de que ... tenemos que tener esos elementos para identificar las anotaciones .. – javanoob