9

I Am trying to add an environmental variable inside my spring-boot application.properties file. I know how to add it normally on a non spring-boot project, but I cannot find the field for adding environment variables, this is all I see:

this is all I see

This is my application.properties file, this may help.

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/FTHLDB
spring.datasource.username=root
spring.datasource.password=${MYSQL_PASS}
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.format_sql=true
LazyOne
  • 158,824
  • 45
  • 388
  • 391
SomeOnionGamer
  • 203
  • 1
  • 4
  • 8

3 Answers3

28

The UI of Run/Debug Configurations has changed. Under 'Modify Options' select 'Environment Variables' under 'Operating System'.

Screenshot of explanation

Joe Tobin
  • 482
  • 3
  • 12
1

run -> Edit Configurations -> edit environment variables. enter image description here

Monika Singh
  • 46
  • 1
  • 3
0

you can write the environment variable name directly with it's value like this myvariable = its value inside the application.properties file and to use it just inject it inside your method or globally inside your class like this public class MyClass{ @Value("${myvariable}"} String myvariable; }

BendabizAdam
  • 51
  • 2
  • 6