Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did deprecate method locations in @ConfigurationProperties?

I'm trying to configure multiple '.yml' in spring boot like...

application.yml

spring:
    profile: local

api.yml

spring:
    profile: local
myapi:
  url: localhost/...

So, I found locations method in @ConfigurationProperties. but, It was deprecated in 1.4.x

Deprecated. as of 1.4 in favor of configuring the environment directly with additional locations

How could I configuring this situation?

like image 910
Hanjin Lee Avatar asked Oct 30 '22 12:10

Hanjin Lee


1 Answers

You can use spring.config.name to change the configuration file names that will be looked for. Multiple names can be configured using a comma-separated list. In your case, you'd want to set it to application,api.

like image 167
Andy Wilkinson Avatar answered Nov 15 '22 11:11

Andy Wilkinson