List of allowed properties in Spring

I have several sources of property files in my spring XML files, they have different order values, and some are optional.

  • application.properties - the default properties are stored in the classpath (return) (lowest priority)
  • [HOSTNAME] .properties - the class path contains properties specific to this name (higher priority)
  • Property file loaded with value in jndi - location specified via jndi with highest priority.

In other words, I can override the default properties set in application.properties with the properties in .properties and override these values ​​in turn with a properties file whose location is being viewed by jndi.

However, I would like spring to provide me with a list of allowed values ​​for all properties. Does anyone know how I can do this?

It's easy for me to get the value of a specific property, but I really need a list of all the allowed properties.

+3
source share
1 answer

I have two suggestions:

  • You can override a class PropertyPlaceholderConfigurerusing a method processPropertiesto populate all the allowed properties. Below is an example here .
  • PropertyPlaceholderConfigurer Spring Ordered, ; order , . , , , .
+1

All Articles