@TestPropertySource vs spring-cloud-config
See original GitHub issueThis doc don not have information about spring-cloud-config… http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
I know that spring-cloud-config will add itself first by default. https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapConfiguration.java#L155
But I thank that spring-cloud-config default order should be the same as JNDI
.
Default spring-cloud-config order > @TestPropertySource
, This will make people very confused.
I think overrideSystemProperties
is not a good way.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
What is the loading precedence for properties from Spring ...
Points 12 and 14 cover Spring Cloud Config. 12.Profile-specific application properties outside of your packaged ...
Read more >Part 4: Writing Tests - Medium
It uses that class to start a Spring application context. @TestPropertySource annotation tells the test application to use a different property ...
Read more >[Solved]-Should I mock Spring Cloud Config server properties ...
Coding example for the question Should I mock Spring Cloud Config server ... You can use @TestPropertySource annotation to fake properties during test:...
Read more >How to Implement Spring Cloud Bus with Examples?
Spring cloud bus is a solution that enables a Spring Cloud Config Server to ... And you can pass the “name” and “desc”...
Read more >A Magic Around Spring Boot Externalized Configuration
By default Spring Boot tries to load application.properties (or ... We can also define @TestPropertySource on our JUnit test to load an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@spencergibb We would like to also use cloud config for integration tests, but in some tests we need to override a couple of properties. Is that possible? Thx!
For unit tests: Agreed. But for system tests I am not so sure.