Spring Boot - Advanced Patterns
How can you correctly inject
ApplicationEventPublisher into a Spring-managed bean?ApplicationEventPublisher into a Spring-managed bean?@Autowired.@Autowired annotation of type ApplicationEventPublisher uses @Autowired correctly. By creating a new instance of ApplicationEventPublisher using the new keyword is invalid because ApplicationEventPublisher is an interface managed by Spring. By extending ApplicationEventPublisher in your bean class is incorrect as it is an interface, not meant to be extended. By annotating the class with @EventPublisher is invalid since @EventPublisher does not exist.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions