FAQ Database Discussion Community

spring profile activation with some beans having no profile

I have a spring file config1.xml that has beans with no explicitly defined profile. I also have another file config2.xml with two bean profiles (profileA and profileB). If I import the latter one into the former and activate profileA at runtime, would the beans in config1.xml be activated? If not,...

How to autowire an implementer with an specific profile in spring?

let me demonstrate with code : public interface A { .... } @Profile({"V1"}) @Component public class B implements A { .... } @Profile({"V2"}) @Component public class C implements A { .... } How can i dynamically (on every request that arrives) make spring to autowire one of above classes according...

Default Spring bean when profile is not present

I'm using Spring MVC controllers, and I'd like to make some extra request-mapped methods available during development. I can do this using Spring profiles: @Controller @Profile("!dev") public class DefaultController { } @Controller @Profile("dev") public class DevController extends DefaultController { } But ideally, I'd rather not pollute the production classes' code...