From 196ca845c8ab9724855bb67e692f39069b024c36 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Wed, 20 Jan 2021 13:32:19 +0000 Subject: [PATCH] Demonstrate Bean Lifecycle with PostConstruct --- .../main/java/conference/service/SpeakerServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Spring/src/main/java/conference/service/SpeakerServiceImpl.java b/Spring/src/main/java/conference/service/SpeakerServiceImpl.java index cf904e4..be2d0db 100644 --- a/Spring/src/main/java/conference/service/SpeakerServiceImpl.java +++ b/Spring/src/main/java/conference/service/SpeakerServiceImpl.java @@ -3,6 +3,7 @@ package conference.service; import conference.model.Speaker; import conference.repository.SpeakerRepository; +import javax.annotation.PostConstruct; import java.util.List; public class SpeakerServiceImpl implements SpeakerService { @@ -13,6 +14,11 @@ public class SpeakerServiceImpl implements SpeakerService { this.speakerRepository = speakerRepository; } + @PostConstruct + private void initialise() { + System.out.println("Initialisation After Constructors"); + } + public void setSpeakerRepository(SpeakerRepository speakerRepository) { this.speakerRepository = speakerRepository; }