Properties annotated with @Value are not being set on my beans.
My context and classes are inside a jar that is on the classpath of another project. Its spring context imports my spring context and my spring context loads a config file from the classpath and contains various bean definitions.
Lazy loading is not being used anywhere, my jar is using Spring 3.1.4 and the project using my jar is using Spring 3.2.3.
Logger showing properties file is loaded when the external project loads it's context (which imports mine)
[main] INFO Loading properties file from class path resource [connector-config.properties] - (PropertyPlaceholderConfigurer.java:172:)
Excerpt from my Spring context:
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
lazy-init="false">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>classpath:connector-config.properties</value>
</list>
</property>
</bean>
...
<!-- The actual beans referenced are not foo bar and com but should not be relevant to this issue -->
<bean id="requestGenerator" class="com.connector.RequestGenerator">
<constructor-arg name="foo" ref="foo" />
<constructor-arg name="bar" ref="bar" />
<constructor-arg name="com" ref="com" />
</bean>
config file that is on classpath of project using my jar
ruleType=PAUL
response.poolSize=10
ack.poolSize=10
#This needs to be in minutes
max.run.time=100
base.dir=\\
Class from external project loading a bean from my context: By inspecting the requestGen object in Eclipse debug mode I can see the property ruleType is null. Given the above properties file, ruleType should be "PAUL" but it is null.
public class App
{
public static void main(Straing[] args)
{
@SuppressWarnings("resource")
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring-context.xml");
RequestGenerator requestGen = context.getBean("requestGenerator", RequestGenerator.class);
requestGeneratorbean definition.ruleTypeisnull. Do you get an NPE? Show us the stack trace?