How to Resolve “Could Not Autowire org. springframework . . . - Baeldung
Alternatively, if we manually define a JavaMailSender bean, we must ensure our bean is added to the Spring context correctly. By default, Spring Boot scans for components starting from the package that contains the main application class and includes all of its sub-packages.
more