Home > front end >  Spring web application with profile
Spring web application with profile

Time:03-07

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

  • Added spring.profiles.active=dev in catalina.properties file enter image description here

  • Added setenv.sh in tomcat bin folder enter image
description here

  • Added spring.profiles.active=dev on STS run configuration

Above 3 solution are not working.

How to solve this problem.

Thanks in advance.

CodePudding user response:

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.

  • Related