I have a problem integrating external library with Spring. It contains a class annotated with @Configuration
and it has a method annotated with @Bean
. I don't want it to be instantiated (it's not needed and introduces dependency on a Spring Boot, which I don't use.
Unfortunately this @Configuration
-annotated class is used elsewhere in the library (required by the class type, not interface type, so I need to instantiate exactly this class).
I exluded it's package from auto-scanning, I'm not importing it directly. Just constructing it by hand and registering in own configuration as a bean.
So, to make story short - I need to register a bean, but exclude it from annotation scnanning (to not process it's @Bean
-annotated methods). Any way for doing this?