I've a Spring boot application with a classic bootstrap who will get the settings in a git repo :
# =====================================
# = Common properties for every profile
# =====================================
spring:
application:
name: myapplication
---
# ====================================
# = local profile
# ====================================
spring:
config:
activate:
on-profile: local
cloud:
config:
uri: http://localhost:8000
---
If I run this application, it works perfectly but I've a mistake when I run the unit test.
For the moment, I only have the basic unique test :
@SpringBootTest
class MyApplicationTests {
@Test
void contextLoads() {
}
}
This error is due to the context load :
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
And I understand why : when the test is running, I don't know why, but the application try to load the config files from localhost:8888 and not localhost:8000, like it's setted in the bootstrap.
I suppose it's a "by default" config, but how can I tell to the test to find the config file in the good port?