Java – lists the resolved properties in spring

There are multiple attribute file sources in my spring XML file. They have different order values, and some are optional

> application. Properties – in the classpath, save the default (fallback) property (lowest priority) > [hostname] Properties – in the classpath, include the properties specific to the hostname (higher priority) > properties file loaded by value in JNDI – the location specified in via JNDI, with the highest priority

In other words, I can use The properties in properties override application The default properties set in properties, and then overwrite these values through the property file of JNDI to find its location

However, I want some way for spring to give a list of resolved values for all my properties Who knows how I do this?

I can easily get the value of a particular property, but what I really need is a list of all the resolved properties

Solution

I have two suggestions:

>You can override the propertyplaceholderconfigurer class with the method processproperties to populate all resolved properties An example is here. > Because propertyplaceholderconfigurer implements the ordered interface of spring, you can have multiple property placeholders; They are then assigned orders in the order they should be in the application Finally, after you have extended the class, you will be able to access all resolved properties in the order they should be loaded

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>