I have Spring boot app and I create my own autoconfiguration that should create bean in case any RestController in present in the context.
It looks something like that:
@AutoConfiguration
@ConditionalOnBean(RestController.class)
public class MyCustomAutoConfiguration {
@Bean
public MyBean myBean(){
// code to create my bean
}
}
I did defined class annotated with @RestController
and I it works when I access it .
But my AutoConfiguration doesn't kick in . I get the following:
condition":"OnBeanCondition","message":"@ConditionalOnBean (types: org.springframework.web.bind.annotation.RestController; SearchStrategy: all) did not find any beans of type org.springframework.web.bind.annotation.RestController"}],"matched":[]}
As far as I know Autoconfiguration is done AFTER component scanning detected bean of type restcontroller..so why it didn't pick mine?