Comments (4)
All things considered, we don't believe this to be a good change. It's more consistent to do what the users has defined in their configuration, for consistency with what's happening with production code. For hierarchical test cases, like this one, inheritLocations
should be used to disable what's coming from the parent if necessary.
from spring-framework.
Code related to this can be found in:
AbstractTestContextBootstrapper.buildMergedContextConfiguration(Class<?>, List<ContextConfigurationAttributes>, MergedContextConfiguration, CacheAwareContextLoaderDelegate, boolean)
MergedContextConfiguration.processStrings(String[])
from spring-framework.
Do you think following a similar approach to what's done on activeProfiles
would work? You can see this proposal in the branch above
from spring-framework.
Do you think following a similar approach to what's done on
activeProfiles
would work?
No, I think it's unfortunately a bit more involved than that. Otherwise, we would have enforced uniqueness with a LinkedHashSet
for both the locations
and classes
a long time ago.
Our goal here is actually not to enforce uniqueness within the entire set of locations or classes, because the duplicate presence of a configuration location or class can be intentional (or at least necessary) due to nuances of the overall configuration -- for example, because that's how the production application works. (Note: I'm not saying that any form of duplication is ideal, but I recall that we didn't go for strict uniqueness because of certain use cases in the wild.)
Rather, we want to detect when a certain class in the test class hierarchy declares the same set of locations or classes, in the exact same order, as its superclass. If we detect such accidental duplication, we then want to remove the duplication.
As I hinted at in my previous comment, we would likely need to build that logic into AbstractTestContextBootstrapper.buildMergedContextConfiguration(...)
.
As a side note, I suppose we would also want to remove any adjacent, duplicate configuration locations or classes.
For example, @ContextConfiguration(locations = {"config1.xml", "config1.xml", "config2.xml"})
and @ContextConfiguration(classes = {"Config1", "Config1", "Config2"})
should probably never load config1.xml
and Config1
twice.
from spring-framework.
Related Issues (20)
- Introduce `CompilableIndexAccessor` SPI in SpEL HOT 2
- Coroutines throws a ClassCastException: kotlin.reflect.jvm.internal.KTypeParameterImpl cannot be cast to class kotlin.reflect.KClass HOT 4
- Refine scheme, userinfo, host and port parsing in UriComponentsBuilder
- Refine scheme, userinfo, host and port parsing in UriComponentsBuilder HOT 1
- Refine scheme, userinfo, host and port parsing in UriComponentsBuilder HOT 1
- Why is the max regex length of expression#OperatorMatches always changing? HOT 3
- EncoderHttpMessageWriter adds a Content-Type header even if there's no body HOT 4
- why CVE-2016-1000027 just appear on HttpInvoker? HOT 3
- Prevent subscription with same subscription ID in websocket
- Spring hibernate is throwing java.lang.NoClassDefFoundError: javax/transaction/SystemException HOT 2
- Validate that `private` JUnit Jupiter lifecycle methods are not annotated with `@Autowired`
- Memory Leak in Jetty HttpConnections with SSE in Spring Boot 3.2.4 Using Jetty 12.0.7
- AbstractJackson2Encoder fails to encode entity from exception handler because of committed ServerHttpResponse if Flux contains onError signal(s) after onNext HOT 2
- Document that DataIntegrityViolationException can also be thrown on read-only queries HOT 1
- @05466739569
- Make @Cacheable evaluate condition on each call HOT 5
- WebFlux temporary file not always deleted with parallel uploads. HOT 1
- Change @Transactional AOP Default Order to 0 HOT 3
- Introduce `getName()` in SpEL's `BeanReference`
- Document that RestTemplate may not return a body for certain exceptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-framework.