[英]How can I inject a property value into an annotation configured spring mvc 3.0 controller
[英]How can I inject a property value into a Spring Bean which was configured using annotations?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
我有一堆 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
訪問我感興趣的財產?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.