Skip to content

Commit 801d74a

Browse files
authored
Merge pull request eugenp#6063 from MajewskiKrzysztof/BAEL-2483
BAEL-2483
2 parents bdcc961 + 34b90a3 commit 801d74a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.baeldung.annotation;
2+
3+
import org.springframework.stereotype.Component;
4+
import javax.annotation.PostConstruct;
5+
import javax.annotation.PreDestroy;
6+
7+
@Component
8+
public class MyBean {
9+
10+
private final TestBean testBean;
11+
12+
public MyBean(TestBean testBean) {
13+
this.testBean = testBean;
14+
System.out.println("Hello from constructor");
15+
}
16+
17+
@PostConstruct
18+
private void postConstruct() {
19+
System.out.println("Hello from @PostConstruct method");
20+
}
21+
22+
@PreDestroy
23+
public void preDestroy() {
24+
System.out.println("Bean is being destroyed");
25+
}
26+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.baeldung.annotation;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class TestBean {
7+
8+
}

0 commit comments

Comments
 (0)