Spring Boot - Spring Annotations
Given the following Spring Boot bean code:
What will be printed when the application context starts and then closes?
public class MyService {
@PostConstruct
public void start() {
System.out.println("Starting service");
}
@PreDestroy
public void stop() {
System.out.println("Stopping service");
}
}What will be printed when the application context starts and then closes?
