Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Conditionally load a bean in spring boot using xml configuration?

 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Spring Boot 2.1.
I have some mixed configuration in my project : XML files and java classes with annotations. We have this current configuration which works :

application.properties :


applicationContext-file.xml :


We want to extract the component values from the spring.profiles.active property since they have nothing to do with the environment :

application.properties :


How can i condition the instantiation of the myserviceimpl bean inside the applicationContext-file.xml ? I can no longer rely on the profile attribute since the spring.profiles.active property no longer includes the values of the components.

Thanks for helping.
 
Ranch Hand
Posts: 1795
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Celinio,
Can you try to put this ?

 
Celinio Fernandes
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Himai Minh wrote:Hi, Celinio,
Can you try to put this ?



How does that help ?? Re-read my question.
 
Himai Minh
Ranch Hand
Posts: 1795
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I heard profiles can be overridden.
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!