我有一堆Spring bean,它们是通过注释从类路径中拾取的,例如
@Repository("personDao")
public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {
    // Implementation omitted
}
在Spring XML文件中,定义了一个PropertyPlaceholderConfigurer:
<bean id="propertyConfigurer" 
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="/WEB-INF/app.properties" />
</bean> 
我想将app.properites的属性之一注入到上面显示的bean中。我不能简单地做这样的事情
<bean class="com.example.PersonDaoImpl">
    <property name="maxResults" value="${results.max}"/>
</bean>
因为PersonDaoImpl在Spring XML文件中没有功能(它是通过注释从类路径中拾取的)。我有以下内容:
@Repository("personDao")
public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao {
    @Resource(name = "propertyConfigurer")
    protected void setProperties(PropertyPlaceholderConfigurer ppc) {
    // Now how do I access results.max? 
    }
}
但是我不清楚我如何从中访问我感兴趣的财产ppc?
PropertyPlaceholderConfigurer不再推荐使用该类。更喜欢PropertySourcesPlaceholderConfigurer。无论如何,您都可以使用较短的XML定义<context:property-placeholder />。