I have written a custom processor app to read data from MongoDB. In this app, I use MongoTemplate for MongoDB operation, so SpringBoot has provide the MongoProperties class for properties loading.
However, when I try to white list MongoProperties so that I can see these properties on WebUI dashboard, I encounter some problem. It just shows "No properties avaliable".
I have followed the 23.1 Whitelisting application properties in the document to add the following line in spring-configuration-metadata-whitelist.properties file
configuration-properties.classes=org.springframework.boot.autoconfigure.mongo.MongoProperties
And add the following dependency in pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
I have read the code of spring-cloud-stream-app-starters/mongodb on github. It seems that it does the same with me.
Actually, I have written several other apps, and the WebUI shows the white-listed properties normally. The only difference is that, in these apps, I create my own @ConfigurationProperty class.
May I ask, what else should I do to white list the spring boot provided @ConfigurationProperty class(in my case, MongoProperties)?
Thank you very much for any advice!
An easier way to debug this is to unpack your application jar file and verify if you have :
META-INF/spring-configuration-metadata-whitelist.properties
META-INF/spring-configuration-metadata.json
in your classpath (usually via app starter jar) and the spring-configuration-metadata-whitelist.properties
has the entries for the required properties