Is it possible to use placeholder in context.xml

前端 未结 2 1965
星月不相逢
星月不相逢 2021-01-13 17:20

I\'m using Spring and struts and have the following entry in \'/META-INF/context.xml\'




        
2条回答
  •  情深已故
    2021-01-13 17:59

    For Tomcat, you can setup a connection pool in the server's server.xml file, that way the username/password is outside of your war file. Here's some info on how Context elements behave in Tomcat 5.5 http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

    Alternately, you can use the standalone DBCP package from Apache from your Spring config file, and use the jdbc.properties to replace your username/password in there. For example:

    
    
      
        com.microsoft.sqlserver.jdbc.SQLServerDriver
      
      
        ${jdbc.url}
      
      
        ${jdbc.username}
      
      
        ${jdbc.password}
      
      
        30
      
      
        100
      
      
        10000
      
    
    

提交回复
热议问题