Java Web Application Configuration Patterns

前端 未结 10 757
夕颜
夕颜 2020-12-22 18:58

Are there any patterns or best practices that can be used to simplify changing configuration profiles for java web applications across multiple environments. e.g. JDBC URLs,

10条回答
  •  忘掉有多难
    2020-12-22 19:40

    This is heavily going to depend on what options the web application servers give you. We have multiple environments for JBoss with different JDBC URLs, the JNDI name remains the same across all servers, just the configuration on the local instance changes, so nothing goes wrong from build to build.

    I guess the short answer is that the best practice is to externalize the configurations and keep a good file in place with the correct settings for each server, and have the web app read that configuration. The exact nature of the externalization and reading is going to depend on the specific configuration and application server.

    EDIT: These configurations do not exist as part of the war (ear in our case) that way they are not overwritten.

提交回复
热议问题