zoukankan      html  css  js  c++  java
  • Java war包取之外的properties文件

    由于服务器发布war项目不尽相同,所以获取properties也不尽相同。

    tomcat:

    Properties config = new Properties();
    String url = Thread.currentThread().getContextClassLoader().getResource("").getPath().replaceAll("%20", " ");
    String path = url.substring(0, url.indexOf(APPLICATION_NAME)) + PROPERTIES_FILE_NAME;
    config.load(new FileInputStream(path));

    glassfish:

    question:

    I'm currently migrating from WebSphere 6.1 to Glassfish v3, I managed to deploy an application but I'm stuck trying to locate where to put the properties files and getting the application find them.
    On WebSphere 6.1 was something like "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/properties"
    Where would that be for GlassFish v3? "/opt/oracle/glassfishv3/glassfish/domains/domain1/.......?"

    answer:

    you could put the properties file into the lib/classes directory of your domain. Everything in that directory gets added to the classpath.

  • 相关阅读:
    Flink学习四:Flink运行架构
    Flink学习三:Flink安装
    Flink学习二:Flink基本架构
    进程的作业
    并发编程
    粘包解决模板
    网络下载作业
    网络通信远程操控
    网络编程套接字
    网络编程基础之网络协议篇
  • 原文地址:https://www.cnblogs.com/voctrals/p/3016624.html
Copyright © 2011-2022 走看看