BAEL-2483

This commit is contained in:
Krzysztof Majewski 2019-01-03 14:15:43 +01:00
parent 829b11e1f3
commit 34b90a33aa
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package com.baeldung.annotation;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Component
public class MyBean {
private final TestBean testBean;
public MyBean(TestBean testBean) {
this.testBean = testBean;
System.out.println("Hello from constructor");
}
@PostConstruct
private void postConstruct() {
System.out.println("Hello from @PostConstruct method");
}
@PreDestroy
public void preDestroy() {
System.out.println("Bean is being destroyed");
}
}

View File

@ -0,0 +1,8 @@
package com.baeldung.annotation;
import org.springframework.stereotype.Component;
@Component
public class TestBean {
}