我有一堆SpringBean,它们是通过注释从类路径中获取的,例如.
@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>
我想从应用程序中注入一个属性.如上图所示,在豆子中加入适当的淀粉.我不能简单地做这样的事情
<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
开始进入我感兴趣的房产?