普通java工程的resources目录寻址

问题:

普通java工程的src/main/resources目录下的配置文件如何寻址

在src/main/java目录下的代码中如何访问src/main/resources目录下的配置文件?

 

Maven packs all the files and folders under main/resourcesinto the jar file at the the root

 

比如src/main/resources/config.xml,那么在代码中直接用“config.xml”就可以访问了。这个前提是,这是一个maven的项目。

posted @ 2018-12-28 17:49  PhoenixTree(梧桐树)  阅读(466)  评论(0编辑  收藏  举报