Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:13:57+00:00 2026-05-31T05:13:57+00:00

I am configuring my spring application per-environemnt and I came to following problem: As

  • 0

I am configuring my spring application per-environemnt and I came to following problem:

As long as the environment changes just bean constructor/properties values I am fine with using PropertyPlaceholderConfigurer.

Now I am facing the fact that the bean structure itself change in different environemnts. E.g. in test environemnt I define single bean where in production environment I define another bean of same interface which requires property of type List set – in another words different structure where PropertyPlaceholderConfigurer can’t really help.

I went with defining per-environment spring xml configuration importing it via <import resource="myDefinition-${Environment}.xml />. This is also fine until I want have it optional. The resource I am defining there is @Autowired(required = false) to another bean.

Since <import ... /> doesn’t allow optional attribute (as can be seen here: https://jira.springsource.org/browse/SPR-1624) I ended up having empty .xml configuration files for environemnts where I don’t require having that bean. This is somewhat inconvenient.

Could anyone advice on best practice in such scenario?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:13:57+00:00Added an answer on May 31, 2026 at 5:13 am

    Bean definition profiles, introduced in Spring 3.1 are designed to solve just this kind of problem. See http://static.springsource.org/spring/docs/3.1.0.RC2/spring-framework-reference/html/new-in-3.1.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem configuring IntelliJ IDEA for developing spring and maven powered application.
I get the following error while configuring concurrency in Spring Security 3.05. I am
am having a problem configuring tomcat with richfaces. I copied the: richfaces-components-ui-4.2.2.Final.jar richfaces-components-api-4.2.2.Final.jar richfaces-core-api-4.2.2.Final.jar
I am configuring django for using django admin tool, following steps in webpage http://www.ibm.com/developerworks/linux/library/l-django/?S_TACT=105AGX52&S_CMP=cn-a-l
I have a Spring application running on the Glassfish Webserver and I'm seeing some
I have a spring web application (currently packaged as a war file) which I
While configuring the security constraints for a web-module's roles in J2EE application I'm having
I am developing a Spring application, and was wondering if there's a part of
Configuring IIS 6.0 to run an MVC3 application I think I have a configuration
I am trying to implement Riot CMS to my Spring-java web application using http://www.riotfamily.org/docs/quickstart.html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.