BAEL-2483
This commit is contained in:
parent
829b11e1f3
commit
34b90a33aa
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.baeldung.annotation;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestBean {
|
||||
|
||||
}
|
Loading…
Reference in New Issue