Monat: April 2020

Keycloak für Learning Friday Projekt „Hogarama“ First Step – JEE Microservices with MicroProfile-Config

Blog

First Step - JEE Microservices with MicroProfile-Config

...as JBoss modules. <dependency> ...
...JBoss modules. <dependency> <groupId>org.eclipse.microprofile.config</groupId> ...
...modules. <dependency> <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> ...
...<groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> <version>${version.microprofile.config}</version> ...
...<artifactId>microprofile-config-api</artifactId> <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> <scope>provided</scope> </dependency> Integration ...
...<version>${version.microprofile.config}</version> <scope>provided</scope> </dependency> Integration with ...
... <scope>provided</scope> </dependency> Integration with Thorntail Thorntail ...
...fraction for MicroProfile-Config. <dependencyManagement> ...
...for MicroProfile-Config. <dependencyManagement> ...
...MicroProfile-Config. <dependencyManagement> <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
...<artifactId>bom</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
...<version>${version.thorntail}</version> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> </dependencies> ...
... </dependencies> ...
... </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies> ...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
...<artifactId>microprofile-config</artifactId> </dependency> ...
... </dependency> ...
... </dependency> </dependencies> Integration ...
... </dependency> </dependencies> Integration with Quarkus Quarkus, ...
...specific Quarkus version. <dependencyManagement> <dependencies> ...
...version. <dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
...<artifactId>quarkus-bom</artifactId> ...
... ...
... ...
... ...
... ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
...<version>${quarkus.version}</version> ...
... ...
... ...
... ...
... ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies> ...
... </dependency> </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies> ...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... <!-- ...
... <!-- Does ...
... <!-- Does not ...
...dependency defined. ...
...defined. ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... It ...
... It uses ...
... It uses Smallrye ...
...implementation of ...
...of ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... the ...
... the MicroProfile-Config ...
... the MicroProfile-Config as ...
...as default ...
...default ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... for ...
... for configurations ...
... for configurations --> ...
...for configurations --> </dependencies> How to provide ...
...in standalone.xml: <system-properties> <property ...
...standalone.xml: <system-properties> <property name="conax.request.dir" ...
...<system-properties> <property name="conax.request.dir" value="/tmp/cmnt/req"/> ...
...standalone.xml: <subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source ...
...<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="props"> ...
...xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="props"> ...
... <config-source name="props"> ...
...<config-source name="props"> ...
...name="props"> ...
... ...
... <property ...
... <property name="prop1" ...
... <property name="prop1" value="foo"/> ...
...<property name="prop1" value="foo"/> ...
...name="prop1" value="foo"/> ...
...value="foo"/> ...
... ...
... <property ...
... <property name="prop2" ...
... <property name="prop2" value="bar"/> ...
...<property name="prop2" value="bar"/> </config-source> </subsystem> Directory ...
...name="prop2" value="bar"/> </config-source> </subsystem> Directory configuration ...
...value="bar"/> </config-source> </subsystem> Directory configuration in ...
...standalone.xml: <subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="file-props"> ...
... <config-source name="file-props"> ...
...<config-source name="file-props"> ...
...name="file-props"> <dir ...
... <dir path="/etc/config/numbers-app"/> ...
... <dir path="/etc/config/numbers-app"/> ...
... <dir path="/etc/config/numbers-app"/> </config-source> </subsystem> Configuring ...
...via the JBoss-CLI: ...
...the JBoss-CLI: ...
...JBoss-CLI: ...
... ...
... ...
... ...
... ...
... /subsystem=microprofile-config-smallrye/config-source=file-props ...
... /subsystem=microprofile-config-smallrye/config-source=file-props \ ...
... /subsystem=microprofile-config-smallrye/config-source=file-props \ ...
.../subsystem=microprofile-config-smallrye/config-source=file-props \ ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... :add(dir={path=/etc/config/numbers-app}) Configuring ...
... :add(dir={path=/etc/config/numbers-app}) Configuring properties ...
... :add(dir={path=/etc/config/numbers-app}) Configuring properties via ...
...via the JBoss-CLI: /subsystem=microprofile-config-smallrye/config-source=props ...
...the JBoss-CLI: /subsystem=microprofile-config-smallrye/config-source=props \ ...
... /subsystem=microprofile-config-smallrye/config-source=props \ ...
.../subsystem=microprofile-config-smallrye/config-source=props \ ...
...\ ...
... ...
... ...
... ...
... ...
... :add(properties={"prop1" ...
... :add(properties={"prop1" = ...
... :add(properties={"prop1" = "foo", ...
...MicroProfile-Config configuration: # Configurations for ...
...for all stages thorntail: ...
...stages thorntail: microprofile: ...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config: ...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
...STATIC_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... info: ...
... info: "The ...
... info: "The application ...
..."The application info..." — — - ...
...— — - project: ...
...- project: stage: ...
... project: stage: local ...
...project: stage: local ...
...stage: local thorntail: ...
... thorntail: microprofile: ...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config: ...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
...LOCAL_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... prop: ...
... prop: "local-prop" ...
... prop: "local-prop" ...
... prop: "local-prop" — — - ...
...— — - project: ...
...- project: stage: ...
... project: stage: test ...
...project: stage: test ...
... stage: test thorntail: ...
...test thorntail: microprofile: ...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config: ...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
...TEST_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... prop: ...
... prop: "test-prop" ...
... prop: "test-prop" ...
...prop: "test-prop" — — - ...
...— — - project: ...
...- project: stage: ...
... project: stage: cloud ...
...project: stage: cloud ...
... stage: cloud thorntail: ...
...cloud thorntail: microprofile: ...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config: ...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
...CLOUD_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... Dir: ...
... Dir: “/config/app” How ...
... Dir: “/config/app” How to ...
...class User { public final String ...
...final String username; public final String ...
...final String firstname; public User(String username, ...
...String firstname) { this.username ...
...firstname) { this.username = ...
...{ this.username = username; ...
...this.username = username; this.firstname ...
...= username; this.firstname = ...
...username; this.firstname = firstname; ...
...this.firstname = firstname; } } // Converts a ...
...implements Converter<User> { @Override public ...
...{ @Override public User convert(String ...
...convert(String value) { final ...
...value) { final String[] ...
...{ final String[] properties ...
...properties = value.split(";"); final ...
...= value.split(";"); final String ...
...value.split(";"); final String username ...
...final String username = properties; ...
... = properties; final ...
...= properties; final String ...
...properties; final String firstname ...
...final String firstname = properties; ...
... = properties; return ...
...= properties; return new ...
...properties; return new User(username, ...
...new User(username, firstname); } } How to provide ...
...class Configuration { @Inject @ConfigProperty(name ...
...{ @Inject @ConfigProperty(name = "info.text", ...
...= "info.text", defaultValue=“...”) private String infoText; ...
...private String infoText; @Inject @ConfigProperty(name ...
...infoText; @Inject @ConfigProperty(name = "google.apiKey") ...
...@ConfigProperty(name = "google.apiKey") private String apiKey; ...
...private String apiKey; // Getters for ...

Anzeigen