ref ) http://commons.apache.org/configuration/
Spring 프로젝트 + XML Config (commons configuration)
- Apache Common Configuration
2) In Controller Class
Spring 프로젝트 + XML Config (commons configuration)
- Apache Common Configuration
1) In root-context.xml
...
<bean id="systemConfig" class="org.apache.commons.configuration.XMLConfiguration">
<bean id="systemConfig" class="org.apache.commons.configuration.XMLConfiguration">
<constructor-arg index="0"><value>config/system-config.xml</value></constructor-arg>
</bean>
<bean id="dataConfig" class="org.apache.commons.configuration.XMLConfiguration">
<constructor-arg index="0"><value>config/data-config.xml</value></constructor-arg>
</bean>
2) In Controller Class
@Autowired
private org.apache.commons.configuration.XMLConfiguration systemConfig;
@Autowired
private org.apache.commons.configuration.XMLConfiguration dataConfig;
@RequestMapping(value = { "", "/", "/input" }, method = RequestMethod.GET)
public String getUploadForm(Model model)
{
model.addAttribute(new SpringUploadItem());
logger.info("systemConfig:" + systemConfig.getString("name"));
logger.info("dataConfig:" + dataConfig.getString("name"));
return "upload/uploadForm";
}