Spring externalizes configuration and assembly of JNDI objects

1. External arrangement

1: Replace the placeholder: <contect : property-placeholer location = "classpath : /db.properies"> 

Placeholders can not only replace the content in the xml file, but also replace the content of the @value annotation

 

2: Override properties: Use properties files to override Bean properties.

 

3: Encrypt external properties: You need to configure jasypt (class library, which simplifies encryption operations in java) property placeholders and property rewriting as bean elements

Property placeholder First configure <bean class = "EncryptablePropertyPlaceHolderConfigurer">, also need a string encryptor, in  jasypt , property placeholder and property override configuration use this character encryptor to decrypt the characters found in the external configuration file encrypted value.

 

Second, assemble the JNDI object

java naming and directory interface: JNDI

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326615372&siteId=291194637