Spring datasource configuration for localhost, development, and production

前端 未结 6 912
暖寄归人
暖寄归人 2021-02-02 00:53

I\'m trying to figure out how my Spring app can determine where it is deployed and load the appropriate datasource. We have 3 environments...my local, the development server, a

6条回答
  •  一生所求
    2021-02-02 01:31

    Two solutions

    • Have one value instead of three with a generic name and in your build configuration provide a flag which properties file should be copied to that path/filename.

    • Provide the properties as an VM argument while starting the server like -Ddatasource.properties=c:\config\development.datasource.properties and in your XML config file file:///${datasource.properties}

提交回复
热议问题