Este contenido no está disponible en el idioma seleccionado.
Chapter 3. Administer MicroProfile in JBoss EAP
3.1. MicroProfile Telemetry administration Copiar enlaceEnlace copiado en el portapapeles!
3.1.1. Add MicroProfile Telemetry subsystem using the management CLI Copiar enlaceEnlace copiado en el portapapeles!
The MicroProfile Telemetry component is integrated into the default MicroProfile configuration through the microprofile-telemetry subsystem. You can also add the MicroProfile Telemetry subsystem using the management CLI if the subsystem is not included.
Prerequisites
- The OpenTelemetry subsystem must be added to the configuration before adding the MicroProfile Telemetry subsystem. The MicroProfile Telemetry subsystem depends on the OpenTelemetry subsystem.
Procedure
- Open your terminal.
Run the following command:
$ <JBOSS_HOME>/bin/jboss-cli.sh -c <<EOF if (outcome != success) of /subsystem=opentelemetry:read-resource /extension=org.wildfly.extension.opentelemetry:add() /subsystem=opentelemetry:add() end-if /extension=org.wildfly.extension.microprofile.telemetry:add /subsystem=microprofile-telemetry:add reload EOF
3.1.2. Enable MicroProfile Telemetry subsystem Copiar enlaceEnlace copiado en el portapapeles!
MicroProfile Telemetry is disabled by default and must be enabled on a per-application basis.
Prerequisites
- The MicroProfile Telemetry subsystem has been added to the configuration.
- The OpenTelemetry subsystem has been added to the configuration.
Procedure
-
Open your
microprofile-config.propertiesfile. Set the
otel.sdk.disabledproperty tofalse:otel.sdk.disabled=false
3.1.3. Override server configuration using MicroProfile Config Copiar enlaceEnlace copiado en el portapapeles!
You can override server configuration for individual applications in the MicroProfile Telemetry subsystem using MicroProfile Config.
For example, the service name used in exported traces by default is the same as the deployment archive. If the deployment archive is set to my-application-1.0.war, the service name will be the same. To override this configuration, you can change the value of the otel.service.name property in your configuration file:
otel.service.name=My Application
3.2. MicroProfile Config configuration Copiar enlaceEnlace copiado en el portapapeles!
3.2.1. Adding properties in a ConfigSource management resource Copiar enlaceEnlace copiado en el portapapeles!
You can store properties directly in a config-source subsystem as a management resource.
Procedure
Create a ConfigSource and add a property:
/subsystem=microprofile-config-smallrye/config-source=props:add(properties={"name" = "jim"})
3.2.2. Configuring directories as datasources Copiar enlaceEnlace copiado en el portapapeles!
When a property is stored in a directory as a file, the file-name is the name of a property and the file content is the value of the property.
Procedure
Create a directory where you want to store the files:
$ mkdir -p ~/config/prop-files/Navigate to the directory:
$ cd ~/config/prop-files/Create a file
nameto store the value for the propertyname:$ touch nameAdd the value of the property to the file:
$ echo "jim" > nameCreate a ConfigSource in which the file name is the property and the file contents the value of the property:
/subsystem=microprofile-config-smallrye/config-source=file-props:add(dir={path=~/config/prop-files})This results in the following XML configuration:
<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="file-props"> <dir path="/etc/config/prop-files"/> </config-source> </subsystem>
3.2.3. Configuring root directories as ConfigSources Copiar enlaceEnlace copiado en el portapapeles!
You can define a directory as a root directory for multiple MicroProfile ConfigSource directories using the root attribute.
The nested root attribute is part of the dir complex attribute for the /subsystem=microprofile-config-smallrye/config-source=* resource. This eliminates the need to specify multiple ConfigSource directories if they share the same root directory.
Any files directly within the root directory are ignored. They will not be used for configuration. Top-level directories are treated as ConfigSources. Any nested directories will also be ignored.
ConfigSources for top-level directories are assigned the ordinal of the /subsystem=microprofile-config-smallrye/config-source=* resource by default.
If the top-level directory contains a config_ordinal file, the value specified in the file will override the default ordinal value. If two top-level directories with the same ordinal contain the same entry, the names of the directories are sorted alphabetically and the first directory is used.
Prerequisites
-
You have installed the MicroProfile Config extension and enabled the
microprofile-config-smallryesubsystem.
Procedure
- Open your terminal.
Create a directory where you want to store your files:
mkdir -p ~/etc/config/prop-files/Navigate to the directory that you created:
cd ~/etc/config/prop-files/Create a file
nameto store the value for the propertyname:touch nameAdd the value of the property to the file:
echo "jim" > nameRun the following command in the CLI to create a ConfigSource in which the filename is the property and the file contains the value of the property:
/subsystem=microprofile-config-smallrye/config-source=prop-files:add(dir={path=/etc/config, root=true})This results in the XML configuration:
<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:2.0"> <config-source name="prop-files"> <dir path="/etc/config" root="true"/> </config-source> </subsystem>
3.2.4. Obtaining ConfigSource from a ConfigSource class Copiar enlaceEnlace copiado en el portapapeles!
You can create and configure a custom org.eclipse.microprofile.config.spi.ConfigSource implementation class to provide a source for the configuration values.
Procedure
The following management CLI command creates a
ConfigSourcefor the implementation class namedorg.example.MyConfigSourcethat is provided by a JBoss module namedorg.example.If you want to use a
ConfigSourcefrom theorg.examplemodule, add the<module name="org.eclipse.microprofile.config.api"/>dependency to thepath/to/org/example/main/module.xmlfile./subsystem=microprofile-config-smallrye/config-source=my-config-source:add(class={name=org.example.MyConfigSource, module=org.example})This command results in the following XML configuration for the
microprofile-config-smallryesubsystem.<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="my-config-source"> <class name="org.example.MyConfigSource" module="org.example"/> </config-source> </subsystem>Properties provided by the custom
org.eclipse.microprofile.config.spi.ConfigSourceimplementation class are available to any JBoss EAP deployment.
3.2.5. Obtaining ConfigSource configuration from a ConfigSourceProvider class Copiar enlaceEnlace copiado en el portapapeles!
You can create and configure a custom org.eclipse.microprofile.config.spi.ConfigSourceProvider implementation class that registers implementations for multiple ConfigSource instances.
Procedure
Create a
config-source-provider:/subsystem=microprofile-config-smallrye/config-source-provider=my-config-source-provider:add(class={name=org.example.MyConfigSourceProvider, module=org.example})The command creates a
config-source-providerfor the implementation class namedorg.example.MyConfigSourceProviderthat is provided by a JBoss Module namedorg.example.If you want to use a
config-source-providerfrom theorg.examplemodule, add the<module name="org.eclipse.microprofile.config.api"/>dependency to thepath/to/org/example/main/module.xmlfile.This command results in the following XML configuration for the
microprofile-config-smallryesubsystem:<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source-provider name="my-config-source-provider"> <class name="org.example.MyConfigSourceProvider" module="org.example"/> </config-source-provider> </subsystem>Properties provided by the
ConfigSourceProviderimplementation are available to any JBoss EAP deployment.
3.3. MicroProfile Fault Tolerance configuration Copiar enlaceEnlace copiado en el portapapeles!
3.3.1. Adding the MicroProfile Fault Tolerance extension Copiar enlaceEnlace copiado en el portapapeles!
The MicroProfile Fault Tolerance extension is included in standalone-microprofile.xml and standalone-microprofile-ha.xml configurations that are provided as part of JBoss EAP XP.
The extension is not included in the standard standalone.xml configuration. To use the extension, you must manually enable it.
Prerequisites
- JBoss EAP 8.1 with JBoss EAP XP 6.0 is installed.
Procedure
Add the MicroProfile Fault Tolerance extension using the following management CLI command:
/extension=org.wildfly.extension.microprofile.fault-tolerance-smallrye:addEnable the
microprofile-fault-tolerance-smallryesubsystem using the following managenent command:/subsystem=microprofile-fault-tolerance-smallrye:addReload the server with the following management command:
reload
3.4. MicroProfile Health configuration Copiar enlaceEnlace copiado en el portapapeles!
3.4.1. Examining health using the management CLI Copiar enlaceEnlace copiado en el portapapeles!
You can check system health using the management CLI.
Procedure
Examine health:
/subsystem=microprofile-health-smallrye:check { "outcome" => "success", "result" => { "status" => "UP", "checks" => [] } }
3.4.2. Examining health using the management console Copiar enlaceEnlace copiado en el portapapeles!
You can check system health using the management console.
A check runtime operation shows the health checks and the global outcome as boolean value.
Procedure
- Navigate to the Runtime tab and select the server.
-
In the Monitor column, click MicroProfile Health
View.
3.4.3. Examining health using the HTTP endpoint Copiar enlaceEnlace copiado en el portapapeles!
Health check is automatically deployed to the health context on JBoss EAP, so you can obtain the current health using the HTTP endpoint.
The default address for the /health endpoint, accessible from the management interface, is http://127.0.0.1:9990/health.
Procedure
To obtain the current health of the server using the HTTP endpoint, use the following URL:.
http://<host>:<port>/healthAccessing this context displays the health check in JSON format, indicating if the server is healthy.
3.4.4. Enabling authentication for MicroProfile Health Copiar enlaceEnlace copiado en el portapapeles!
You can configure the health context to require authentication for access.
Procedure
Set the
security-enabledattribute totrueon themicroprofile-health-smallryesubsystem./subsystem=microprofile-health-smallrye:write-attribute(name=security-enabled,value=true)Reload the server for the changes to take effect.
reloadAny subsequent attempt to access the
/healthendpoint triggers an authentication prompt.
3.4.5. Readiness probes that determine server health and readiness Copiar enlaceEnlace copiado en el portapapeles!
JBoss EAP XP 6.0.0 supports three readiness probes to determine server health and readiness.
-
server-status- returnsUPwhen the server-state isrunning. -
boot-errors- returnsUPwhen the probe detects no boot errors. -
deployment-status- returnsUPwhen the status for all deployments isOK.
These readiness probes are enabled by default. You can disable the probes using the MicroProfile Config property mp.health.disable-default-procedures.
The following example illustrates the use of the three probes with the check operation:
[standalone@localhost:9990 /] /subsystem=microprofile-health-smallrye:check
{
"outcome" => "success",
"result" => {
"status" => "UP",
"checks" => [
{
"name" => "boot-errors",
"status" => "UP"
},
{
"name" => "server-state",
"status" => "UP",
"data" => {"value" => "running"}
},
{
"name" => "empty-readiness-checks",
"status" => "UP"
},
{
"name" => "deployments-status",
"status" => "UP"
},
{
"name" => "empty-liveness-checks",
"status" => "UP"
},
{
"name" => "empty-startup-checks",
"status" => "UP"
}
]
}
}
3.4.6. Global status when probes are not defined Copiar enlaceEnlace copiado en el portapapeles!
The :empty-readiness-checks-status, :empty-liveness-checks-status, and :empty-startup-checks-status management attributes specify the global status when no readiness, liveness, or startup probes are defined.
These attributes allow applications to report ‘DOWN’ until their probes verify that the application is ready, live, or started up. By default, applications report ‘UP’.
The
:empty-readiness-checks-statusattribute specifies the global status forreadinessprobes if noreadinessprobes have been defined:/subsystem=microprofile-health-smallrye:read-attribute(name=empty-readiness-checks-status) { "outcome" => "success", "result" => expression "${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}" }The
:empty-liveness-checks-statusattribute specifies the global status forlivenessprobes if nolivenessprobes have been defined:/subsystem=microprofile-health-smallrye:read-attribute(name=empty-liveness-checks-status) { "outcome" => "success", "result" => expression "${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}" }The
:empty-startup-checks-statusattribute specifies the global status forstartupprobes if nostartupprobes have been defined:/subsystem=microprofile-health-smallrye:read-attribute(name=empty-startup-checks-status) { "outcome" => "success", "result" => expression "${env.MP_HEALTH_EMPTY_STARTUP_CHECKS_STATUS:UP}" }The
/healthHTTP endpoint and the:checkoperation that checkreadiness,liveness, andstartupprobes also take into account these attributes.
You can also modify these attributes as shown in the following example:
/subsystem=microprofile-health-smallrye:write-attribute(name=empty-readiness-checks-status,value=DOWN)
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
3.5. MicroProfile JWT configuration Copiar enlaceEnlace copiado en el portapapeles!
3.5.1. Enabling microprofile-jwt-smallrye subsystem Copiar enlaceEnlace copiado en el portapapeles!
The MicroProfile JWT integration is provided by the microprofile-jwt-smallrye subsystem and is included in the default configuration. If the subsystem is not present in the default configuration, you can add it as follows.
Prerequisites
- JBoss EAP 8.1 with JBoss EAP XP 6.0 is installed.
Procedure
Enable the MicroProfile JWT smallrye extension in JBoss EAP:
/extension=org.wildfly.extension.microprofile.jwt-smallrye:addEnable the
microprofile-jwt-smallryesubsystem:/subsystem=microprofile-jwt-smallrye:addReload the server:
reloadThe
microprofile-jwt-smallryesubsystem is enabled.
3.6. MicroProfile OpenAPI administration Copiar enlaceEnlace copiado en el portapapeles!
3.6.1. Enabling MicroProfile OpenAPI Copiar enlaceEnlace copiado en el portapapeles!
The microprofile-openapi-smallrye subsystem is provided in the standalone-microprofile.xml configuration. However, JBoss EAP XP uses the standalone.xml by default. You must include the subsystem in standalone.xml to use it.
Alternatively, you can follow the procedure Updating standalone configurations with MicroProfile subsystems and extensions to update the standalone.xml configuration file.
Procedure
Enable the MicroProfile OpenAPI smallrye extension in JBoss EAP:
/extension=org.wildfly.extension.microprofile.openapi-smallrye:add()Enable the
microprofile-openapi-smallryesubsystem using the following management command:/subsystem=microprofile-openapi-smallrye:add()Reload the server.
reloadThe
microprofile-openapi-smallryesubsystem is enabled.
3.6.2. Requesting an MicroProfile OpenAPI document using Accept HTTP header Copiar enlaceEnlace copiado en el portapapeles!
Request an MicroProfile OpenAPI document, in the JSON format, from a deployment using an Accept HTTP header.
By default, the OpenAPI endpoint returns a YAML document.
Prerequisites
- The deployment being queried is configured to return an MicroProfile OpenAPI document.
Procedure
Issue the following
curlcommand to query the/openapiendpoint of the deployment:$ curl -v -H'Accept: application/json' http://localhost:8080/openapi < HTTP/1.1 200 OK ... {"openapi": "3.0.1" ... }Replace http://localhost:8080 with the URL and port of the deployment.
The Accept header indicates that the JSON document is to be returned using the
application/jsonstring.
3.6.3. Requesting an MicroProfile OpenAPI document using an HTTP parameter Copiar enlaceEnlace copiado en el portapapeles!
Request an MicroProfile OpenAPI document, in the JSON format, from a deployment using a query parameter in an HTTP request.
By default, the OpenAPI endpoint returns a YAML document.
Prerequisites
- The deployment being queried is configured to return an MicroProfile OpenAPI document.
Procedure
Issue the following
curlcommand to query the/openapiendpoint of the deployment:$ curl -v http://localhost:8080/openapi?format=JSON < HTTP/1.1 200 OK ...Replace http://localhost:8080 with the URL and port of the deployment.
The HTTP parameter
format=JSONindicates that JSON document is to be returned.
3.6.4. Configuring JBoss EAP to serve a static OpenAPI document Copiar enlaceEnlace copiado en el portapapeles!
Configure JBoss EAP to serve a static OpenAPI document that describes the REST services for the host.
When JBoss EAP is configured to serve a static OpenAPI document, the static OpenAPI document is processed before any Jakarta RESTful Web Services and MicroProfile OpenAPI annotations.
In a production environment, disable annotation processing when serving a static document. Disabling annotation processing ensures that an immutable and versioned API contract is available for clients.
Procedure
Create a directory in the application source tree:
$ mkdir APPLICATION_ROOT/src/main/webapp/META-INFAPPLICATION_ROOT is the directory containing the
pom.xmlconfiguration file for the application.Query the OpenAPI endpoint, redirecting the output to a file:
$ curl http://localhost:8080/openapi?format=JSON > src/main/webapp/META-INF/openapi.jsonBy default, the endpoint serves a YAML document,
format=JSONspecifies that a JSON document is returned.Configure the application to skip annotation scanning when processing the OpenAPI document model:
$ echo "mp.openapi.scan.disable=true" > APPLICATION_ROOT/src/main/webapp/META-INF/microprofile-config.propertiesRebuild the application:
$ mvn clean installDeploy the application again using the following management CLI commands:
Undeploy the application:
undeploy microprofile-openapi.warDeploy the application:
deploy APPLICATION_ROOT/target/microprofile-openapi.warJBoss EAP now serves a static OpenAPI document at the OpenAPI endpoint.
3.6.5. Disabling microprofile-openapi-smallrye Copiar enlaceEnlace copiado en el portapapeles!
You can disable the microprofile-openapi-smallrye subsystem in JBoss EAP XP using the management CLI.
Procedure
Disable the
microprofile-openapi-smallryesubsystem:/subsystem=microprofile-openapi-smallrye:remove()
3.7. MicroProfile Reactive Messaging administration Copiar enlaceEnlace copiado en el portapapeles!
3.7.1. Configuring the required MicroProfile reactive messaging extension and subsystem for JBoss EAP Copiar enlaceEnlace copiado en el portapapeles!
If you want to enable asynchronous reactive messaging to your instance of JBoss EAP, you must add its extension through the JBoss EAP management CLI.
Prerequisites
- You added the Reactive Streams Operators with SmallRye extension and subsystem. For more information, see MicroProfile Reactive Streams Operators Subsystem Configuration: Required Extension.
- You added the Reactive Messaging with SmallRye extension and subsystem.
Procedure
- Open the JBoss EAP management CLI.
Enter the following code:
[standalone@localhost:9990 /] /extension=org.wildfly.extension.microprofile.reactive-messaging-smallrye:add {"outcome" => "success"} [standalone@localhost:9990 /] /subsystem=microprofile-reactive-messaging-smallrye:add { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }NoteIf you provision a server using Galleon, either on OpenShift or not, make sure you include the
microprofile-reactive-messagingGalleon layer to get the core MicroProfile 2.0.1 and reactive messaging functionality, and to enable the required subsystems and extensions. Note that this configuration does not contain the JBoss EAP modules you need to enable connectors. Use themicroprofile-reactive-messaging-kafkalayer or themicroprofile-reactive-messaging-amqplayer to enable the Kafka connector or the AMQP connector, respectively.
Verification
You have successfully added the required MicroProfile Reactive Messaging extension and subsystem for JBoss EAP if you see success in two places in the resulting code in the management CLI.
If the resulting code says reload-required, you have to reload your server configuration to completely apply all of your changes. To reload, in a standalone server CLI, enter reload.
3.8. Standalone server configuration Copiar enlaceEnlace copiado en el portapapeles!
3.8.1. Standalone server configuration files Copiar enlaceEnlace copiado en el portapapeles!
The JBoss EAP XP includes additional standalone server configuration files, standalone-microprofile.xml and standalone-microprofile-ha.xml.
Standard configuration files that are included with JBoss EAP remain unchanged. Note that JBoss EAP XP 6.0.0 does not support the use of domain.xml files or domain mode.
| Configuration File | Purpose | Included capabilities | Excluded capabilities |
|---|---|---|---|
|
| This is the default configuration that is used when you start your standalone server. | Includes information about the server, including subsystems, networking, deployments, socket bindings, and other configurable details. | Excludes subsystems necessary for messaging or high availability. |
|
| This configuration file supports applications that use MicroProfile. | Includes information about the server, including subsystems, networking, deployments, socket bindings, and other configurable details. | Excludes the following capabilities:
|
|
|
Includes default subsystems and adds the | Excludes subsystems necessary for messaging. | |
|
| This standalone file supports applications that use MicroProfile. |
Includes the | Excludes subsystems necessary for messaging. |
|
|
Includes the | ||
|
| Support for every possible subsystem. | Includes subsystems for messaging and high availability in addition to default subsystems. | |
|
| Support for the minimum subsystems necessary to use the built-in mod_cluster front-end load balancer to load balance other JBoss EAP instances. |
By default, starting JBoss EAP as a standalone server uses the standalone.xml file. To start JBoss EAP with a standalone MicroProfile configuration, use the -c argument. For example,
$ <EAP_HOME>/bin/standalone.sh -c=standalone-microprofile.xml
3.8.2. Updating standalone configurations with MicroProfile subsystems and extensions Copiar enlaceEnlace copiado en el portapapeles!
You can update standard standalone server configuration files with MicroProfile subsystems and extensions using the docs/examples/enable-microprofile.cli script. The enable-microprofile.cli script is intended as an example script for updating standard standalone server configuration files, not custom configurations.
The enable-microprofile.cli script modifies the existing standalone server configuration and adds the following MicroProfile subsystems and extensions if they do not exist in the standalone configuration file:
-
microprofile-config-smallrye -
microprofile-fault-tolerance-smallrye -
microprofile-health-smallrye -
microprofile-jwt-smallrye -
microprofile-openapi-smallrye
The enable-microprofile.cli script outputs a high-level description of the modifications. The configuration is secured using the elytron subsystem. The security subsystem, if present, is removed from the configuration.
Prerequisites
- JBoss EAP 8.1 with JBoss EAP XP 6.0 is installed.
Procedure
Run the following CLI script to update the default
standalone.xmlserver configuration file:$ <EAP_HOME>/bin/jboss-cli.sh --file=docs/examples/enable-microprofile.cliSelect a standalone server configuration other than the default
standalone.xmlserver configuration file using the following command:$ <EAP_HOME>/bin/jboss-cli.sh --file=docs/examples/enable-microprofile.cli -Dconfig=<standalone-full.xml|standalone-ha.xml|standalone-full-ha.xml>- The specified configuration file now includes MicroProfile subsystems and extensions.
3.9. Deploying multiple MicroProfile .war applications on a standalone JBoss EAP XP server Copiar enlaceEnlace copiado en el portapapeles!
You can deploy multiple MicroProfile .war applications concurrently on a standalone JBoss EAP XP server. Each deployment runs independently with its own runtime environment, MicroProfile Config properties, class loading, and service management.
MicroProfile Telemetry generates OpenTelemetry signals for each deployment and supports multitenancy.
This guidance covers:
3.9.1. Support for multiple MicroProfile deployments Copiar enlaceEnlace copiado en el portapapeles!
MicroProfile components on a standalone JBoss EAP XP server operate independently for each .war deployment. However, multiple deployment support in JBoss EAP XP is limited to .war applications only.
Each deployment isolates its MicroProfile Config properties, including:
-
Properties in
META-INF/microprofile-config.properties -
Properties provided by custom
ConfigSourceorConfigSourceProviderimplementations
Global properties from the MicroProfile Config subsystem, system properties, or environment variables apply to all deployments.
MicroProfile Long Running Action support for multiple deployments uses a single-coordinator model to manage multiple participants.
The following MicroProfile components also operate independently in each deployment:
- MicroProfile Fault Tolerance
- MicroProfile Reactive Messaging
- MicroProfile Health
- MicroProfile REST Client
- MicroProfile JWT
Each deployment maintains its own configuration.
3.9.2. Deploying multiple MicroProfile .war applications Copiar enlaceEnlace copiado en el portapapeles!
This procedure demonstrates deploying multiple MicroProfile .war applications by using two applications to show how deployment-level MicroProfile Config properties override subsystem-level settings. Each application maintains its own configuration and runs concurrently without interference, ensuring configuration isolation and predictable behavior.
Prerequisites
- A standalone JBoss EAP XP server is installed.
-
Two MicroProfile
.warapplications are packaged and namedapp1.warandapp2.war. Each application includes a REST resource to verify configuration values, for example:
@Path("/config") @ApplicationScoped public class ConfigResource { @Inject Config config; @GET @Path("/{key}") public Response getValue(@PathParam("key") String key) { String value = config.getOptionalValue(key, String.class).orElse(null); if (value == null) { return Response.status(404).build(); } return Response.ok(value).build(); } }NoteThis REST resource verifies that deployment-level MicroProfile Config properties override subsystem-level settings while maintaining isolation.
Procedure
Add shared and override properties at the subsystem level by using the following commands:
/subsystem=microprofile-config-smallrye/config-source=subsystem-config:add(properties={"shared.property" => "subsystem-level"}) /subsystem=microprofile-config-smallrye/config-source=subsystem-config:add(properties={"override.property" => "subsystem-value"})-
shared.property: Available to all deployments unless a deployment overrides it. -
override.property: Set at subsystem level but will be overridden inapp1.warto demonstrate deployment-level priority.
-
Create a
microprofile-config.propertiesfile in theMETA-INFdirectory of each application with the following properties:For
app1.war:app.property=app1-level override.property=deployment-value custom.property=app1-onlyThis configuration includes:
-
app.property: A deployment-specific value. -
override.property: Overrides a subsystem-level property. custom.property: Unique to this deployment.For
app2.war:app.property=app2-levelThis configuration includes only
app.property, which defines a deployment-specific value.
-
Deploy the first application,
app1.war, by using the following command:./jboss-cli.sh --connect --command="deploy /path/to/app1.war"Deploy the second application,
app2.war, by using the following command:./jboss-cli.sh --connect --command="deploy /path/to/app2.war"
Verification
Verify that the shared subsystem property is available to both deployments by using the following commands:
curl -X GET http://localhost:8080/app1/config/shared.property # Expected output: subsystem-level curl -X GET http://localhost:8080/app2/config/shared.property # Expected output: subsystem-levelVerify that each deployment has its own deployment-specific property by using the following commands:
curl -X GET http://localhost:8080/app1/config/app.property # Expected output: app1-level curl -X GET http://localhost:8080/app2/config/app.property # Expected output: app2-levelVerify that the deployment-level property overrides the subsystem-level property in
app1.warby using the following commands:curl -X GET http://localhost:8080/app1/config/override.property # Expected output: deployment-value curl -X GET http://localhost:8080/app2/config/override.property # Expected output: subsystem-valueVerify that custom.property exists only in
app1.warby using the following commands:curl -X GET http://localhost:8080/app1/config/custom.property # Expected output: app1-only curl -X GET http://localhost:8080/app2/config/custom.property # Expected output: 404 Not Found
3.9.3. Behavior of MicroProfile components in multiple .war deployments Copiar enlaceEnlace copiado en el portapapeles!
The following table summarizes MicroProfile component behavior in multiple .war deployments. It lists each component, its behavior, and key notes for quick reference.
| Component | Behavior in multiple deployments | Notes |
|---|---|---|
| MicroProfile Config | Each deployment maintains its own properties. Environment variables and system properties apply to all deployments. |
Applies to all integrated MicroProfile specifications. Supports only multiple top-level |
| MicroProfile Fault Tolerance | Each deployment behaves independently. Metrics generated by MicroProfile Fault Tolerance annotations and methods contribute to the same collector. | - |
| MicroProfile Reactive Messaging | Each deployment isolates its channel configuration. Messages remain within their deployment. | Each deployment can use the same channel names with different backends or protocols without interference. |
| MicroProfile Reactive Streams Operators | Components are stateless. They do not affect other deployments. | - |
| MicroProfile Health | Each deployment contributes health checks to the global server health endpoint. |
The |
| MicroProfile OpenAPI | Each deployment provides its own OpenAPI endpoints and models. Applications operate independently per host but contribute to the same OpenAPI documentation generation at the server level. | Host-specific MicroProfile Config properties control global model conflicts. |
| MicroProfile REST Client | Works per deployment. Each deployment uses only its own configuration. | - |
| MicroProfile Telemetry | Each deployment sends signals tagged with its application name, supporting multitenancy. | Generates OpenTelemetry signals. |
| MicroProfile JWT | Each deployment isolates JWT authentication. The server creates virtual security domains on demand. | Configuration is specific to the application and managed through MicroProfile Config. |
| MicroProfile Long Running Action | The server allows only one coordinator. Multiple participant deployments can contribute to the same MicroProfile Long Running Action. | Participants do not interfere. |