Reputation: 19606
My application looks like below. In this configuration my application works (it is bootstrapped with the @ComponentScan).
Unfortunately then /actuator/health does not work. When I remove @ComponentScan then actuator works but my application does not work.
What do I need to configure to make both @ComponentScan and actuator work?
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan(basePackageClasses = {DistributionApp.class})
public class Main extends SpringBootServletInitializer {
...
}
Upvotes: 2
Views: 281
Reputation: 19606
I found the actual issue.
I had a class with:
@Component
@ApplicationPath("/")
This shadowed the /actuator endpoints. So they did not show up. So the problem was not related to @ComponentScan but it only surfaced when my own classes were activated.
Upvotes: 2