Does application.yaml refer to the contents of other configuration files?

configuration file of how application.yaml in SpringBoot is referenced.

spring:
    datasource:
        druid:
            url: ${jdbc.url}
            username: ${jdbc.username}

where jdbc.url , jdbc.username is in another file jdbc.yaml .

how is it implemented?

Mar.07,2021

you can use maven's profiles. Placeholder replacement is performed during build based on the profiles configuration in maven.


you can name the jdbc.yaml file application-jdbc.yaml .
set the jvm parameter -Dspring.profiles.active=jdbc when starting spring-boot , so that spring-boot will load the application.yaml configuration file and the corresponding profile configuration file.

multiple profile are separated by commas

$ java -Dspring.profiles.active=jdbc,jdbc2 -jar [xxx].jar
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-1e460c1-43133.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-1e460c1-43133.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?