-
[프로그래밍] Loading xml resource files in spring maven project2011.11.08 PM 04:24
By default Maven project has resource folder located "src/main/resources"
If your class have to read some resource files try these samples.
assumption you have 1 xml files to read
src/main/resource/yourTest.xml
String RESOURCE_FILE = "yourTest.xml"
URL resourceURL = this.getClass().getClassLoader().getResource(RESOURCE_FILE);
or
org.springframework.core.io.Resource resource = new org.springframework.core.io.ClassPathResource(RESOURCE_FILE);
resource.getURL();
If you don't use maven, don't use spring just create folder in src directory
src/config/yourTest.xml
String RESOURCE_FILE = "/config/yourTest.xml"
URL resourceURL = getClass().getResource(PROFILE_XML);
댓글 : 2 개
user error : Error. B.