java - Spring Boot: comment utiliser plusieurs fichiers yml

Mots clés : javaspringyamlspring-bootjava

meilleur 3 Réponses java - Spring Boot: comment utiliser plusieurs fichiers yml

vote vote

91

$ cat src/main/resources/application.yml: spring:   profiles:     include: >       profile1,       profile2,       ...       profileN  $ ls -lah src/main/resources/config: drwxr-xr-x  4 mak  staff   136B Apr 16 23:58 . drwxr-xr-x  6 mak  staff   204B Apr 17 01:54 .. -rw-r--r--  1 mak  staff    60B Apr 16 23:58 application-profile1.yml -rw-r--r--  1 mak  staff    62B Apr 16 23:16 application-profile2.yml ... -rw-r--r--  1 mak  staff    50B Apr 16 23:16 application-profileN.yml 
vote vote

87

spring.profiles.active: test 
vote vote

70

application.yml application-dev.yml application-uat.yml application-prod.yml 
  spring:       profiles:        active: dev     application: /* optional */        name: Application Name  

Questions similaires