Merge pull request #6063 from MajewskiKrzysztof/BAEL-2483

BAEL-2483
This commit is contained in:
Tom Hombergs 2019-01-03 20:10:09 +01:00 committed by GitHub
commit 801d74ad0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {
}