我的 XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="filterBySlic" class="ca.ups.tundra.msg.FilterMessagesBySlic">
<property name="slicList">
<list><value>4196</value><value>1101</value><value>2795</value></list>
</property>
<property name="messageList">
<list><value>7762</value><value>7765</value><value>7766</value><value>7767</value><value>7768</value></list>
</property>
<property name="serviceLevelList">
<list><value>E1</value><value>E3</value><value>E4</value><value>29</value></list>
</property>
<property name="serviceTypeList">
<list><value>029</value><value>096</value></list>
</property>
</bean>
</beans>
这是我在课堂上使用的:
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring-pred-filter.xml"});
FilterMessagesBySlic filterConfig = (FilterMessagesBySlic)context.getBean("filterBySlic");
我访问值列表的条件;
filterConfig.getSiteList().contains(msgSlic)
这工作正常。相反,我需要使用@Autowired
来访问这些值列表!任何建议