title: Spring Circular placeholder reference while running an executable jar
body: <p>I'm facing "Circular Placeholder reference" exception while trying to run an executable jar file. Here's the detailed exception.</p>
  
  <pre><code>
  org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'postProcessProperties' defined in class path resource [applicationContext.xml]: Circular placeholder reference 'processor.core.poolsize' in property definitions
       [echo]     at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:287)
       [echo]     at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
       [echo]     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
       [echo]     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638)
       [echo]     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
       [echo]     at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
       [echo]     at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
       [echo]     at com.autodesk.postprocess.engine.PostProcessEngine.start(PostProcessEngine.java:39)
       [echo]     at com.autodesk.postprocess.engine.PostProcessEngine.main(PostProcessEngine.java:29)
  </code></pre>
  
  <p>This is a spring application which uses an external property file to read values at startup. Here's the spring definition. This has worked pretty well till now.</p>
  
  <pre><code>
  &lt;bean id="propertyConfig"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_NEVER" /&gt;
          &lt;property name="ignoreResourceNotFound" value="true" /&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;classpath:/postprocess.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="properties"&gt;
              &lt;props&gt;
                  &lt;prop key="processor.core.poolsize"&gt;${processor.core.poolsize}&lt;/prop&gt;
                  &lt;prop key="processor.max.poolsize"&gt;${processor.max.poolsize}&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="postProcessProperties"
          class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
          &lt;property name="properties"&gt;
              &lt;props&gt;
                  &lt;prop key="processor.core.poolsize"&gt;${processor.core.poolsize}&lt;/prop&gt;
                  &lt;prop key="processor.max.poolsize"&gt;${processor.max.poolsize}&lt;/prop&gt;
                  &lt;prop key="processor.polling.delay"&gt;${processor.polling.delay}&lt;/prop&gt;
                  &lt;prop key="processor.polling.period"&gt;${processor.polling.period}&lt;/prop&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>I'm using shade plugin to generate the jar file. Here's a snippet
  <pre><code>
  &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.7.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;shade&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;transformers&gt;
                                  &lt;transformer
                                      implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                      &lt;mainClass&gt;com.test.postprocess.engine.PostProcessEngine&lt;/mainClass&gt;
                                  &lt;/transformer&gt;
                                  &lt;transformer
                                      implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;
                                      &lt;resource&gt;META-INF/spring.handlers&lt;/resource&gt;
                                  &lt;/transformer&gt;
                                  &lt;transformer
                                      implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;
                                      &lt;resource&gt;META-INF/spring.schemas&lt;/resource&gt;
                                  &lt;/transformer&gt;
                              &lt;/transformers&gt;
                              &lt;filters&gt;
                                  &lt;filter&gt;
                                      &lt;artifact&gt;<em>:</em>&lt;/artifact&gt;
                                      &lt;excludes&gt;
                                          &lt;exclude&gt;META-INF/<em>.SF&lt;/exclude&gt;
                                          &lt;exclude&gt;META-INF/</em>.DSA&lt;/exclude&gt;
                                          &lt;exclude&gt;META-INF/*.RSA&lt;/exclude&gt;
                                      &lt;/excludes&gt;
                                  &lt;/filter&gt;
                              &lt;/filters&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  </pre></code></p>
  
  <p>I'm not sure what's causing this issue, as I've used similar pattern before in other executable jar files.</p>
  
  <p>Any pointer will be appreciated.</p>
  
  <p>Thanks</p>