# servlet-contxt.xml
<!– classpath는 이 프로젝트에서는 resources –>
<beans:bean id=“properties”class=“org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<beans:property name=“locations”>
<beans:list>
<beans:value>classpath:config.properties</beans:value>
</beans:list>
</beans:property>
</beans:bean>
# Controller
@Value(“${root.path}”)
String rootPath;
@RequestMapping(“/jsonSample”)
public @ResponseBody String jsonSample() {
System.out.println(“##############” + rootPath);
JSONArray objList = new JSONArray();
objList.put(“test1”);
objList.put(“test2”);
return objList.toString();
}
최근 댓글