Class SearchOrder
- All Implemented Interfaces:
Iterable<ConfigLocation>
Search order is read order. With the default MergeStrategy.FILL_MISSING_ONLY,
earlier sources have priority because they fill values first. With
MergeStrategy.OVERRIDE_EXISTING, later sources win. With
MergeStrategy.FAIL_ON_DUPLICATE, duplicate canonical keys fail. See
docs/search-order.md for examples and preset details.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchOrderReturns an order that reads only classpath library defaults and application classpath resources.static SearchOrderdefaults()Returns the default read order.static SearchOrderReturns an external-first order designed for the default FILL_MISSING_ONLY merge strategy.iterator()Returns locations in read order.static SearchOrdernone()Returns an empty order.static SearchOrderof(ConfigLocation... locations) Creates a search order from the supplied locations.static SearchOrderReturns a production-oriented external-first order.static SearchOrdertest()Returns a test-oriented order that reads the working directory before classpath resources.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
of
Creates a search order from the supplied locations.- Parameters:
locations- locations in read order- Returns:
- search order
-
defaults
Returns the default read order.The default order reads classpath library defaults, application classpath resources, JAR directory files, working directory files, Java system properties, and OS environment variables. It does not include an env-file placeholder, but directory locations read env files when the builder has configured one.
- Returns:
- default search order
-
externalFirst
Returns an external-first order designed for the default FILL_MISSING_ONLY merge strategy.Because search order is read order, external sources are read first and therefore have priority under
MergeStrategy.FILL_MISSING_ONLY. WithMergeStrategy.OVERRIDE_EXISTING, the last source wins and this interpretation changes.- Returns:
- external-first search order
-
classpathOnly
Returns an order that reads only classpath library defaults and application classpath resources.- Returns:
- classpath-only search order
-
production
Returns a production-oriented external-first order.This order favors externally supplied values under the default
MergeStrategy.FILL_MISSING_ONLY. It does not hardcode any /etc path, does not enable a profile, and does not enable env file loading by itself.- Returns:
- production search order
-
test
Returns a test-oriented order that reads the working directory before classpath resources.- Returns:
- test search order
-
none
Returns an empty order.- Returns:
- empty search order
-
locations
Returns locations in read order.- Returns:
- immutable location list
-
iterator
- Specified by:
iteratorin interfaceIterable<ConfigLocation>
-
toString
-