springapplicationcontextspring-profiles

Spring web application with profile


I have a spring application with multiple profile like dev,prod. application running on external tomcat.profile are setting in the pom.xml file

pom.xml

<profiles>
        <profile>
            <id>dev</id>
            <properties>
            <repoManager>Manager1</repoManager>
             ..........
            </properties>
        </profile>
</profiles>

Project have applicationContext.xml file. One of the bean definition, we are taking repoManager the value from dev profile. when i run the application, throwing the following error

rg.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name '<Class name>' defined in class path resource [applicationContext.xml]: Circular placeholder reference 'repoManager' in property definitions

How to run spring web application with profile dev

I have done following changes

Above 3 solution are not working.

How to solve this problem.

Thanks in advance.


Solution

  • I Got the answer

    Right click on the project -> Maven -> Select Maven Profiles... and pickup your profile. enter image description here No Need to do above steps.