How to connect to different databases (development/test/production) transparently with hibernate

前端 未结 4 1658
广开言路
广开言路 2021-01-01 01:35

I have several different databases for different environments to connect my application to. These are constant per installation but differ between them. In other words there

4条回答
  •  醉酒成梦
    2021-01-01 02:34

    Use placeholders for the url, user and password in the config file, and replace those placeholders with actual values when building the application (using ant, Maven, or whatever you use to build your application). The build process itself could take those values from a profile (if using Maven), or from environment variables, or from command-line arguments.

    You just need to build the application three times, with different parameters : once for each target environment.

提交回复
热议问题