属性文件位置是WEB-INF/classes/auth.properties.
我不能使用特定于JSF的方法(使用ExternalContext),因为我需要服务模块中的属性文件,该模块不依赖于Web模块.
我已经试过了
MyService.class.getClassLoader().getResourceAsStream("/WEB-INF/classes/auth.properties");
Run Code Online (Sandbox Code Playgroud)
但它回来了null.
我也试过阅读它,FileInputStream但它需要完整的路径是不可接受的.
有任何想法吗?