Maven 전쟁 프로젝트에서 저는 개발 용 컨테이너로 jetty-maven-plugin을 사용합니다. (구아바) Resources.getResource ("bddconf.xml")와 properties.getClass().의 차이점 getResourceAsStream ("bddconf.xml");
나는 일부 리소스 파일을 필터링, 특히의는 "bddconf.xml을"이라는 이름을 할 수 있습니다.이 파일은 받는다는에 의해 필터링 및 대상/classes 디렉토리에 배치됩니다.
이 조각이 파일 후 오래된 집에서 만든 BDD의 FWK 검색 : 나는이 코드를 실행하면
Properties properties = new Properties();
InputStream inputstream = properties.getClass().getResourceAsStream("/bddconf.xml");
, 내 웹 애플리케이션에 (부두)에서, inputStream을은 null입니다.
그것은 작동import com.google.common.io.Resources;
String file = Resources.getResource("bddconf.xml").getFile();
File file2 = new File(file);
logger.info("Does bdd file exists : [" + file2.exists() + "] file : [" + file2.toString() + "]");
// Does bdd file exists : [true] file : [..path..\target\classes\bbdconf.xml]
때문에,이 두 가지 방법의 차이점은 무엇입니까 : 같은 방법이 조각을 가진 반면
?