eclipse动态Web工程中的路径问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 15:57:55
我的控制文件在“Java Resouces:src”的filter包中,在此文件需要读取属性文件aa.properties,aa.properties在路径“WebContent/WEB-INF/properties/”下。请问怎样设置读取路径?(我用的是Spring框架)

web工程中Java Resouces的源文件经过编译后的class是在WebContent/WEB-INF/classes/ 下面的,如果filter包中的类不是web.xml中配置的Filter或则是可以取到request、response的话,读取aa.properties,aa.properties文件可以使用相对路 ../../properties/aa.properties

spring提供了ApplicationContext 来读取工程配置文件