Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从 JAAS loginModule 读取我的应用程序 WEB-INF 文件夹或我的 tomcat/apache 服务器中的属性文件。但我不明白如何以独立于主机名的方式从 LoginModule 中正确引用位置。
您可以使用 catalina.base 系统属性:
File confDir = new File(System.getProperty("catalina.base"), "conf"); File confFile = new File(confDir, "myprops.properties"); InputStream in = new FileInputStream(confFile); try { props.load(in); } finally { in.close(); }