question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@TestPropertySource vs spring-cloud-config

See original GitHub issue

This 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
OldIMPcommented, Jan 18, 2018

@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!

0reactions
tobias-neubertcommented, Dec 3, 2019

For unit tests: Agreed. But for system tests I am not so sure.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found