0

I want to sperate some security fields such as usernames or passwords from my main application.yml file . in fact I want 2 yml file in my project , one for main configs and other for security fields. Is there any way to do that ?

smaple:

Main yml file:

spring:
     application:
      name: My project
  datasource:
    driverClassName:  com.ibm.db2.jcc.DB2Driver
    username: username
    password: password
    url: url
.....

security.yml

username: "username"
password: "password"
....
Amir Nadi
  • 3
  • 2
  • Does this answer your question? [Spring Boot and multiple external configuration files](https://stackoverflow.com/questions/25855795/spring-boot-and-multiple-external-configuration-files) – pringi Feb 09 '22 at 12:14

1 Answers1

0

One option is to specify profile specific .yml files. These are then activated by activating the corresponding profile.

So you can create application-security.yml

And in your main yml file add:

spring:
  profiles:
    include: 
      security
J Asgarov
  • 2,526
  • 1
  • 8
  • 18