Java 从XML迁移到注释(spring)

Java 从XML迁移到注释(spring),java,spring,annotations,Java,Spring,Annotations,我正在尝试将表单XML迁移到以下代码: <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <value>c

我正在尝试将表单XML迁移到以下代码:

<bean       
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  <property name="ignoreResourceNotFound" value="true" />
  <property name="locations">
     <list>
       <value>classpath:spring/file1.properties</value>
       <value>file:${file.prop}</value>
     </list>
   </property>
</bean>
@Bean
public PropertiesFactoryBean fieldNamesProperties() {
   PropertiesFactoryBean fieldNamesProperties = new PropertiesFactoryBean();
   fieldNamesProperties.setIgnoreResourceNotFound(true);
   Resource[] locations = new Resource[2];
   // TODO add resources

   fieldNamesProperties.setLocations(locations);
   return fieldNamesProperties;
}
PropertiesFactoryBean fieldNamesProperties = new PropertiesFactoryBean();
fieldNamesProperties.setLocation(new ClassPathResource("/spring/file1.properties"));