In my Spring app, I have beans configured using annotations, for e.g:
@Repository("personDao")
public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {
// .......
}
In the XML file, I have a bean called “PropertyPlaceholderConfigurer” defines as:
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="loc" value="/WEB-INF/app.properties" />
</bean>
Now, from the app.properties I need to inject a property in the above bean. I tried doing the following:
<bean class="com.example.PersonDaoImpl">
<property name="maxResults" value="${results.max}"/>
</bean>
It's not working, I think the reason behind this is PersonDaoImpl is not a feature in the Spring XML file and is picked up from the classpath using annotations.
So, I tried the below code, but still, I am not able to access the property from PropertyPlaceholderConfigurer.
@Repository("personDao")
public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {
@Resource(name = "propertyConfigurer")
protected void setProperties(PropertyPlaceholderConfigurer ppc) {
// How to access results.max?
}
Can someone suggest how do I access it?