Skip to content

Commit

Permalink
Merge branch 'eclipse:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily-Jiang authored Jul 18, 2023
2 parents 62b581c + 9eb42eb commit b21a366
Show file tree
Hide file tree
Showing 77 changed files with 734 additions and 385 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
java: [11,17]
name: build with jdk ${{matrix.java}}

steps:
Expand All @@ -40,11 +40,13 @@ jobs:
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
name: set up jdk ${{matrix.java}}
with:
distribution: adopt
distribution: temurin
java-version: ${{matrix.java}}

- name: build with maven
run: mvn -ntp formatter:validate install
run: |
mvn -q -N io.takari:maven:0.7.7:wrapper -Dmaven=3.9.0 && ./mvnw -v
./mvnw -ntp formatter:validate install
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ test-output
.vscode/
# Ignore a release.conf for perform_release/* script usage
release.conf
**/.DS_Store
**.DS_Store
*.cache/
14 changes: 7 additions & 7 deletions api/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Bundle-SymbolicName: org.eclipse.microprofile.config
osgi.contract=JavaCDI;\
version:List<Version>='2.0,1.1';\
uses:='\
javax.decorator,\
javax.enterprise.context,\
javax.enterprise.context.spi,\
javax.enterprise.event,\
javax.enterprise.inject,\
javax.enterprise.inject.spi,\
javax.enterprise.util'
jakarta.decorator,\
jakarta.enterprise.context,\
jakarta.enterprise.context.spi,\
jakarta.enterprise.event,\
jakarta.enterprise.inject,\
jakarta.enterprise.inject.spi,\
jakarta.enterprise.util'

# [1] https://www.osgi.org/portable-java-contract-definitions/
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>2.1-SNAPSHOT</version>
<version>3.1-SNAPSHOT</version>
</parent>

<artifactId>microprofile-config-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/org/eclipse/microprofile/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* the programmatically created ones are not required to be serializable.
* <p>
* If one or more converters are registered for a class of a requested value then the registered
* {@link org.eclipse.microprofile.config.spi.Converter} which has the highest {@code @javax.annotation.Priority} is
* {@link org.eclipse.microprofile.config.spi.Converter} which has the highest {@code @jakarta.annotation.Priority} is
* used to convert the string value retrieved from the config sources.
*
* <h2>Usage</h2>
Expand Down Expand Up @@ -257,7 +257,7 @@ default <T> Optional<List<T>> getOptionalValues(String propertyName, Class<T> pr
* The returned sources will be sorted by descending ordinal value and name, which can be iterated in a thread-safe
* manner. The {@link java.lang.Iterable Iterable} contains a fixed number of {@linkplain ConfigSource configuration
* sources}, determined at application start time, and the config sources themselves may be static or dynamic.
*
*
* @return the configuration sources
*/
Iterable<ConfigSource> getConfigSources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*
* <p>
* Example:
*
*
* <pre>
* String restUrl = ConfigProvider.getConfig().getValue(&quot;myproject.some.remote.service.url&quot;, String.class);
* Integer port = ConfigProvider.getConfig().getValue(&quot;myproject.some.remote.service.port&quot;, Integer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.util.AnnotationLiteral;
import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;
import jakarta.enterprise.util.AnnotationLiteral;
import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;

/**
* Retrieve a number of related configuration properties with the specified prefix into a property class. This class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;

import org.osgi.annotation.bundle.Requirement;

import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;

/**
* Binds the injection point with a configured value.
* <p>
* Can be used to annotate injection points of type {@code TYPE}, {@code Optional<TYPE>} or
* {@code javax.inject.Provider<TYPE>}, where {@code TYPE} can be {@code String} and all types which have appropriate
* {@code jakarta.inject.Provider<TYPE>}, where {@code TYPE} can be {@code String} and all types which have appropriate
* converters.
* <p>
* Injected values are the same values that would be retrieved from an injected
Expand Down Expand Up @@ -144,13 +144,13 @@
* <p>
* If the target Type is not String, a proper {@link org.eclipse.microprofile.config.spi.Converter} will get
* applied.
*
*
* Empty string as the default value will be ignored, which is same as not setting the default value. That means
* that any default value string should follow the formatting rules of the registered Converters.
*
*
* If a property has been emptied by a config source with a higher ordinal by setting an empty configuration value
* or by using a value causing the used converter returning {@code null}, the default value will not be used.
*
*
* @return the default value as a string
*/
@Nonbinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
* @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
* @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
*/
@org.osgi.annotation.versioning.Version("1.1")
@org.osgi.annotation.versioning.Version("2.0")
package org.eclipse.microprofile.config.inject;
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@
* @author <a href="emijiang@uk.ibm.com">Emily Jiang</a>
* @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
*/
@org.osgi.annotation.versioning.Version("2.0.0")
@org.osgi.annotation.versioning.Version("3.0.0")
package org.eclipse.microprofile.config;
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected ConfigProviderResolver() {
* method if you like to destroy the Config prematurely.
*
* If the given Config is associated within an Application then it will be unregistered.
*
*
* @param config
* the config to be released
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
* <li>{@code double}, {@code Double}, and {@code OptionalDouble} accepting (at minimum) all values accepted by the
* {@link Double#parseDouble(String)} method</li>
* <li>{@code java.lang.Class} based on the result of {@link java.lang.Class#forName}</li>
* <li>{@code java.lang.String}</li>
* </ul>
*
* <h3 id="discovery">Global converter discovery</h3>
Expand Down Expand Up @@ -101,7 +100,7 @@
* <h3 id="priority">Converter priority</h3>
*
* <p>
* A converter implementation class can specify a priority by way of the standard {@code javax.annotation.Priority}
* A converter implementation class can specify a priority by way of the standard {@code jakarta.annotation.Priority}
* annotation or by explicitly specifying the priority value to the appropriate
* {@linkplain ConfigBuilder#withConverter(Class, int, Converter) builder method}.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
* @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
*
*/
@org.osgi.annotation.versioning.Version("2.0")
@org.osgi.annotation.versioning.Version("3.0")
package org.eclipse.microprofile.config.spi;
28 changes: 11 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,22 @@
<parent>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile-parent</artifactId>
<version>1.0</version>
<version>2.8</version>
</parent>

<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>2.1-SNAPSHOT</version>
<version>3.1-SNAPSHOT</version>

<packaging>pom</packaging>
<name>MicroProfile Config</name>
<url>https://microprofile.io/project/eclipse/microprofile-config</url>

<properties>
<inceptionYear>2016</inceptionYear>
<version.microprofile.tck.bom>3.0</version.microprofile.tck.bom>
</properties>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<organization>
<name>Eclipse Foundation</name>
<url>http://www.eclipse.org/</url>
</organization>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/eclipse/microprofile-config/issues</url>
Expand Down Expand Up @@ -91,16 +79,22 @@
<dependencyManagement>
<dependencies>
<!-- TODO - Investigate BND Dependencies-->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>8.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bnd.annotation</artifactId>
<version>5.3.0</version>
<version>6.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.cdi</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion spec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>2.1-SNAPSHOT</version>
<version>3.1-SNAPSHOT</version>
</parent>

<artifactId>microprofile-config-spec</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions spec/src/main/asciidoc/configexamples.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class InjectedConfigUsageSample {
//Instances of Provider<T> are guaranteed to be Serializable.
@Inject
@ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100")
private javax.inject.Provider<Long> timeout;
private jakarta.inject.Provider<Long> timeout;
//Injects a Supplier for the value of myprj.some.supplier.timeout property to
//resolve the property dynamically. Each invocation to Supplier#get() will
Expand Down Expand Up @@ -439,7 +439,7 @@ Since the class with `@ConfigProperties` is a CDI bean, you can use the programm

[source, java]
----
Details details = CDI.current().select(Details.class, ConfigProperties.Literal.NO:PREFIX).get();
Details details = CDI.current().select(Details.class, ConfigProperties.Literal.NO_PREFIX).get();
----

==== Inject the bean annotated with `@ConfigProperties`
Expand Down
20 changes: 16 additions & 4 deletions spec/src/main/asciidoc/configprofile.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ If the property `mp.config.profile` is specified in multiple config sources, the
==== On Property level
The configuration property that utilizes the Config Profile is called a "profile-specific" property. A "profile-specific" property name consists of the following sequence: `% <profile name>.<original property name>`.

Conforming implementations are required to search for a configuration source with the highest ordinal (priority) that provides either the property name or the "profile-specific" property name.
If the configuration source provides the "profile-specific" name, the value of the "profile-specific" property will be returned. If it doesn't contain the "profile-specific" name, the value of the plain property will be returned.
Conforming implementations are required to search all configuration sources that provide either the property name or the "profile-specific" property name.
If the configuration source provides the "profile-specific" name, the value of the "profile-specific" property will be returned.
If it doesn't contain the "profile-specific" name, the value of the plain property will be returned.
Thus, the "profile-specific" concept only influences which value is to be surfaced per config source.


For instance, a config source can be specified as follows.
For instance, a config source (ordinal 100) can be specified as follows.

[source, text]
----
Expand All @@ -75,6 +76,17 @@ In more details, if `mp.config.profile` is set to `dev`, the property `%dev.vehi
The properties `%live.vehicle.name` and `%testing.vehicle.name` are inactive config properties and don't override the property `vehicle.name`.

If `mp.config.profile` is set to `live`, the property `%live.vehicle.name` is the active property. The `vehicleName` will be `train`. Similarly, `bike` will be the value of `vehicleName`, if the profile is `testing`.
If no profile is active, `lorry` will be the value of `vehicleName`.

As explained above, the override scope is per configure source.
For instance, an additional source (ordinal 300) may be specified as follows:

[source, text]
----
vehicle.name=helicopter
----

The value of `vehicleName` will be `helicopter` no matter which profile might be active, as the higher ordinal (300 versus 100) makes the later source win.

==== On Config Source level

Expand Down
4 changes: 2 additions & 2 deletions spec/src/main/asciidoc/configsources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

A `ConfigSource` is exactly what its name says: a source for configured values.
The `Config` uses all configured implementations of `ConfigSource` to look up the property in question. Dynamically added config sources after the `Config` object has been built would be ignored,
which means `Config.getConfigSources` always returns the same collection of `ConfigSource`s. The same rule applies to `ConfigSourceProvider.getConfigSources`.
which means `Config.getConfigSources` always returns the same collection of ``ConfigSource``s. The same rule applies to `ConfigSourceProvider.getConfigSources`.

=== ConfigSource Ordering

Expand Down Expand Up @@ -161,7 +161,7 @@ Alternatively, for the injection style, the following lookup should be used to r
----
@Inject
@ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100")
private javax.inject.Provider<Long> timeout;
private jakarta.inject.Provider<Long> timeout;
----
Whether a `ConfigSource` supports this dynamic behavior or not depends on how it's implemented.
For instance, the default `ConfigSource` microprofile-config.properties and Environment Variables are not dynamic
Expand Down
2 changes: 1 addition & 1 deletion spec/src/main/asciidoc/converters.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ the API requirements of that interface.
The Type parameter of the interface is the target type the String is converted to. If your converter targets a wrapper of a primitive type (e.g. `java.lang.Integer`), the converter applies to both the wrapper type and the primitive type (e.g. `int`)
You have to register your implementation in a file `/META-INF/services/org.eclipse.microprofile.config.spi.Converter` with the fully qualified class name of the custom implementation.

A custom `Converter` can define a priority with the `@javax.annotation.Priority` annotation.
A custom `Converter` can define a priority with the `@jakarta.annotation.Priority` annotation.
If a Priority annotation isn't applied, a default priority of 100 is assumed.
The `Config` will use the `Converter` with the highest `Priority` for each target type.

Expand Down
2 changes: 1 addition & 1 deletion spec/src/main/asciidoc/license-efsl.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Release: {revdate}

== Copyright

Copyright (c) 2016, 2020 Eclipse Foundation.
Copyright (c) {inceptionYear} , {currentYear} Eclipse Foundation.

=== Eclipse Foundation Specification License

Expand Down
3 changes: 2 additions & 1 deletion spec/src/main/asciidoc/property-expressions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ server.endpoint.path.bar=foo
The property `server.url` is expanded to `http://example.org:8080/foo`.

If an expression cannot be expanded and does not have a default value, a `NoSuchElementException` is thrown. In the
Optional case, an empty Optional will be returned.
Optional case, an empty Optional will be returned. In the `ConfigValue` case, an `ConfigValue` with only
the name of the property will be returned.

The number of recursion lookups is not infinite, but a limited number for composed expressions. Implementations are
encouraged to limit the number to `5`, but they can use higher limits if they wish to. When the number of allowed
Expand Down
Loading

0 comments on commit b21a366

Please sign in to comment.