I am unable to load specific Spring boot profile from command line.
applciation.yml file content is as follows and it is placed inside resource folder of my application.
server:
port: 8787
spring:
application:
name: demo
spring:
profiles: local_mysql
datasource:
url: jdbc:mysql://localhost:3306/demo?createDatabaseIfNotExist=true
username: root
password: root
driverClassName: com.mysql.jdbc.Driver
jpa:
hibernate:
ddl-auto: update
dialect: org.hibernate.dialect.MySQLDialect
server:
port: 8787
spring:
profiles: development
datasource:
url: jdbc:mysql://localhost:3306/demo?createDatabaseIfNotExist=true
username: admin
password: admin
driverClassName: com.mysql.jdbc.Driver
jpa:
hibernate:
ddl-auto: update
dialect: org.hibernate.dialect.MySQLDialect
server:
port: 8788
After executing mvn clean package
and running application with
java -jar -Dspring.profiles.active=local_mysql target\demo-1.0.0-SNAPSHOT.jar
Application ignores specified profile and just starts on 8080 with H2 Db instead mySQL.