I am trying to run spring-boot test:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class UserServiceIt{}
THIS test doesnt need/use redis.
In my src/main/resources
i have application.properties file that configures redis:
spring.data.redis.url=redis://localhost:6379
spring.data.redis.host=localhost
spring.data.redis.password=session
spring.data.redis.port=6379
spring.data.redis.timeout=20s
# Spring session
#spring.session.timeout=60s
spring.session.redis.namespace=spring:session
spring.session.redis.flush-mode=on_save
spring.session.redis.cleanup-cron=0 * * * * *
And in my src/test/resource
i have application.properties
:
# Database connection
spring.datasource.url=jdbc:postgresql://localhost:5433/mydb
spring.datasource.username=myuser
spring.datasource.password=mypassword
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Yet when i try to run the test, be it from intellij or from maven, it throws:
Connection refused: no further information: localhost/127.0.0.1:6379
Which means, the original application.properties are used. Why is that ? Why are they used and not overwritten? Thanks for help