Reputation: 566
I have already set environment variables on windows, and actually when I echo them =, I can see their details, however, when I ran tests they seem not to see the environment variables. I have seen similar questions but they weren't helpful. Like this one, this etc but no luck.
this my application-test.properties
file
## PostgreSQL
spring.datasource.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/users_regsitration_test
spring.datasource.username= ${DB_USERNAME}
spring.datasource.password= ${DB_PASSWORD}
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
then, this is the exception am getting :
users_regsitration_test
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:108)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:336)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:109)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319)
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356)
Upvotes: 0
Views: 218
Reputation: 334
If you are running it within IDE, then you need to set those variables in "Run Configuration".
I am assuming that you are using either IntelliJ or eclipse, this can be configured as,
Upvotes: 1