Spring boot multiple configuration files loading, unified loading

preparing to migrate from spring mvc to spring-boot technology stack, there is a doubt about multiple configuration files. In the process of looking at it, I found that the configuration of spring boot is a great advantage, but I didn"t really realize the advantages.

if you have multiple (> 6) properties files, most of them are about the configuration of upstream and downstream addresses, database configuration, and some default variables. But to see spring-boot, you need to have a configuration class for each configuration file, then declare configuration variables in it, and then use the @ Value annotation.

question:
is there a better way to uniformly load all configuration file variables into the spring container and use them directly without having to write multiple configuration bean?

thx

Mar.29,2021

Yes, you need several annotations. The variables of the corresponding configuration type are promoted to the Config, of a class as follows

  

your requirement should divide the configuration into multiple profile, and activate the corresponding profile in different environments.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45e95-4cf0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45e95-4cf0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?