21
SampleBean genannt:@PostConstruct Methode wird nicht im Frühjahr
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");
}
und Konfigurationsdatei wie folgt aus:
<bean id="SampleBean" class="com.springexample.SampleBean">
<property name="beanOne" ref="beanOneOne"></property>
<property name="beanTwo" ref="beanTwoOne"></property>
</bean>
Und ich habe nicht default-init-Methode Attribut auf der Bohnen Tag.
Kann jeder Körper erzählen, warum die @ PostConstruct-Methode nicht aufgerufen wird.
ja es funktioniert jetzt .. Ya..Ich erinnere mich an eine Zeit zurück, ich lernte, dass .. wir diese Elemente haben müssen, um Anmerkungen zu identifizieren .. – javanoob