Using encoded password for the datasource used in spring applicationContext.xml

后端 未结 5 1047
野性不改
野性不改 2021-01-31 18:53

I want to keep encoded password in my below mentioned springApplicationContext.xml

Is there any way to achieve this?

presently I have configured all properties

5条回答
  •  情深已故
    2021-01-31 19:17

    I'd like to look at the larger picture here: why do you want to encrypt values in your properties file? What is your scenario where unauthorized people have access to your properties file?

    A usual technique to deal with this larger problem of storing production credentials is to make credentials a part of your environment as opposed to part of your source code. Here are some ways to do this:

    • Placing the properties file (with plaintext passwords) on the classpath of the web server in production, this way access to that password is controlled by access to the production machine.
    • Store properties in web.xml (context-param with param-name), again this file is part of the environment in which you run your code and not distributed with your code - access to that file is controlled by access to the machine.
    • Use JNDI and configure that resource in your application server.

提交回复
热议问题