[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timing problem of Spring Injection vs. Component Scan?

Hi, all.

I have a Camel/Spring Boot app created from the camel-spring-boot archetype.

I've set up my several Processor and RouteBuilder classes with @Component and have essentially avoided resources/spring/camel-context.xml.

I'm now trying to incorporate a new class which has its own Spring configuration file associated with it ("default-configuration.xml").

I've tried auto-wiring a bean defined in 'default-configuration.xml' into a variable defined in one of my @Component classes - but I keep getting that the bean isn't defined.  (something like, "no suitable bean of type <type> found for auto-wire" -- even though I clearly have such a bean in my Spring config.)

I tried @Autowired on both the variable and then on a setter method.  Both fail.

I assumed this is because the Component scan is being done before the Spring injection...?

Or maybe that doesn't even make sense...

I've googled and searched to see if Spring Boot is looking for Spring configs of a certain name or in a certain location ...?  Or if I have to list the configs in CamelContext in camel-context.xml ...?

At this point I'm throwing things at the wall and seeing what will stick ...

HUGE THANK YOUS as always for your help.