i have application.yml
,application-dev.yml
andapplication-dev.yml
mvn spring-boot:run
You don't need three .yml files for this. You can have a single application.yml file and write profile specific properties in the same where each profile section is separated by 3 hyphen (---)
Next, for selecting the current active profile, you can specify that as well in your application.yml file, like this :
spring:
profiles:
active:
- local
However, this configuration will be overriden if you set an Environment variable, eg : SPRING_PROFILES_ACTIVE = dev
Here is a sample file for you requirement:
# include common properties for every profile in this section
server.port: 5000
spring:
profiles:
active:
- local
---
# profile specific properties
spring:
profiles: local
datasource:
url: jdbc:mysql://localhost:3306/
username: root
password: root
---
# profile specific properties
spring:
profiles: dev
datasource:
url: jdbc:mysql://
username:
password: