This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch docs
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/docs by this push:
new 86a9df6306 docs: rename juneau-microservice-core to
juneau-microservice and document ofText factory renames
86a9df6306 is described below
commit 86a9df6306ef003e142fd7888f2885e45d099511
Author: James Bognar <[email protected]>
AuthorDate: Tue May 19 08:35:12 2026 -0400
docs: rename juneau-microservice-core to juneau-microservice and document
ofText factory renames
- Rename the 14.x microservice docs section from juneau-microservice-core
to juneau-microservice
(TODO-36 module rename): replace 14.01.JuneauMicroserviceCoreBasics.md
with
14.01.JuneauMicroserviceBasics.md, retitle the section in sidebars.ts,
and update the cross
references in 14.09 (inject-aware), 15.02 / 15.04 / 15.07 / 15.09
(jetty), 20.06 (shaded-all),
01.01 (ecosystem), README, downloads, and 9.5 release notes.
- Document the ofJson5/ofJson -> ofText factory rename on
JsonMap/JsonList/Json5Map/Json5List in
the 9.5 release notes, 02.23 ObjectTools, 01.02 Marshalling, and the V9.5
migration guide
(TODO-34 follow-on).
Co-authored-by: Cursor <[email protected]>
---
README.md | 2 +-
pages/release-notes/9.5.0.md | 125 ++++++++++++++++-----
pages/topics/01.01.JuneauEcosystemOverview.md | 2 +-
pages/topics/01.02.Marshalling.md | 4 +-
pages/topics/02.23.ObjectTools.md | 4 +-
pages/topics/14.01.JuneauMicroserviceBasics.md | 44 ++++++++
pages/topics/14.01.JuneauMicroserviceCoreBasics.md | 37 ------
pages/topics/14.09.InjectAwareMicroservice.md | 36 ++++--
pages/topics/15.02.MicroserviceJettyOverview.md | 45 +++++---
pages/topics/15.04.ResourceClasses.md | 25 +++--
pages/topics/15.07.JettyXml.md | 52 +++++----
pages/topics/15.09.Extending.md | 120 ++++++++++----------
pages/topics/20.06.JuneauShadedAll.md | 4 +-
pages/topics/23.01.V9.5-migration-guide.md | 24 +++-
sidebars.ts | 10 +-
src/pages/downloads.md | 2 +-
16 files changed, 342 insertions(+), 194 deletions(-)
diff --git a/README.md b/README.md
index 2c42f6777c..07557b5654 100644
--- a/README.md
+++ b/README.md
@@ -285,7 +285,7 @@ Apache Juneau™ is a single cohesive Java ecosystem
consisting of the following
* **juneau-rest-client** - A universal REST client API for interacting with
Juneau or 3rd-party REST interfaces using POJOs and proxy interfaces.
* **juneau-rest-server-springboot** - Spring boot integration for
juneau-rest-servlet.
* **juneau-rest-mock** - REST testing API.
-* **juneau-microservice-core** - Core microservice API.
+* **juneau-microservice** - Microservice API.
* **juneau-microservice-jetty** - Jetty microservice API.
* **juneau-examples-core** - Core code examples.
* **juneau-examples-rest** - REST code examples.
diff --git a/pages/release-notes/9.5.0.md b/pages/release-notes/9.5.0.md
index 91a236e227..3fc09ddb7c 100644
--- a/pages/release-notes/9.5.0.md
+++ b/pages/release-notes/9.5.0.md
@@ -63,9 +63,10 @@ neutral, marshaller-agnostic base, with JSON5-flavored
siblings in `org.apache.j
**Behavioral break.** `JsonMap.toString()` and `JsonList.toString()` now
return strict
[RFC 8259](https://www.rfc-editor.org/rfc/rfc8259) JSON (was JSON5), and their
`(CharSequence)` /
-`(Reader)` constructors and `ofJson(...)` factories now default to
`JsonParser.DEFAULT` (was
-`Json5Parser.DEFAULT`). See the [v9.5 Migration
Guide](/docs/topics/V9.5-migration-guide) for the
-full breakdown and the recommended fix paths.
+`(Reader)` constructors and `ofText(...)` factories (renamed from
`ofJson(...)`) now default to
+`JsonParser.DEFAULT` (was `Json5Parser.DEFAULT`). See the
+[v9.5 Migration Guide](/docs/topics/V9.5-migration-guide) for the full
breakdown and the
+recommended fix paths.
##### New neutral base in `org.apache.juneau.collections`
@@ -83,9 +84,10 @@ full breakdown and the recommended fix paths.
##### `JsonMap` / `JsonList` retargeted to strict JSON (breaking)
- `toString()` now returns `Json.of(this)` — strict RFC 8259 JSON (was
`Json5.of(this)`).
-- `(CharSequence)` / `(Reader)` constructors and `ofJson(...)` static
factories now default to
- `JsonParser.DEFAULT` (was `Json5Parser.DEFAULT`). Bare-constructor calls
that feed JSON5 input
- (unquoted keys, single-quoted strings) into `new JsonMap(...)` will now
throw `ParseException`.
+- `(CharSequence)` / `(Reader)` constructors and the renamed `ofText(...)`
static factories
+ (previously `ofJson(...)`) now default to `JsonParser.DEFAULT` (was
`Json5Parser.DEFAULT`).
+ Bare-constructor calls that feed JSON5 input (unquoted keys, single-quoted
strings) into
+ `new JsonMap(...)` will now throw `ParseException`.
- The JSON-specific helpers `toJson()` / `toJson5()` / `toJsonl()` / `toJcs()`
/ `toHjson()` /
`toReadableJson5()` stay on `JsonMap` / `JsonList`. **`toJson()` is now the
synonym for
`toString()`**, not `toJson5()`.
@@ -94,8 +96,8 @@ full breakdown and the recommended fix paths.
- `Json5Map` (extends `MarshalledMap`) and `Json5List` (extends
`MarshalledList`) carry the JSON5
flavor that `JsonMap` / `JsonList` used to carry: `toString()` returns
`Json5.of(this)`,
- `(CharSequence)` / `(Reader)` constructors default to `Json5Parser.DEFAULT`,
`ofJson5(...)` static
- factories, JSON5-flavored `putJson5(...)`.
+ `(CharSequence)` / `(Reader)` constructors default to `Json5Parser.DEFAULT`,
single-arg `ofText(...)`
+ static factories (same name as the neutral base), JSON5-flavored
`putJson5(...)`.
- These are the drop-in replacement for callers that today rely on
`JsonMap.toString()` producing
JSON5 or on `new JsonMap("{unquoted:'json5'}")` parsing JSON5.
@@ -143,7 +145,8 @@ the v9.5 migration guide. The short version:
| Old behavior | New behavior | Recommended migration |
|---|---|---|
| `JsonMap.toString()` → JSON5 | strict JSON | Use `Json5Map` (or
`Json5.of(map)`) for JSON5 output. |
-| `new JsonMap("{unquoted:'json5'}")` parses JSON5 | parses strict JSON
(throws) | Use `new Json5Map(...)` / `Json5Map.ofJson5(...)`. |
+| `new JsonMap("{unquoted:'json5'}")` parses JSON5 | parses strict JSON
(throws) | Use `new Json5Map(...)` / `Json5Map.ofText(...)`. |
+| `JsonMap.ofJson(text)` / `JsonList.ofJson(text)` / `Json5Map.ofJson5(text)`
/ `Json5List.ofJson5(text)` | `JsonMap.ofText(text)` / `JsonList.ofText(text)`
/ `Json5Map.ofText(text)` / `Json5List.ofText(text)` | Single-arg parse
factories renamed to `ofText(...)` for consistency with the neutral
`MarshalledMap.ofText(text, Parser)` base. No behavioral change — the subclass
single-arg form still uses the language-specific default parser. (Note:
`JsonList.ofJsonOrCdl(String)` and `Json5Lis [...]
| `Json5Parser.DEFAULT.parse(s, Object.class)` → `JsonMap` | → `Json5Map` |
Cast to `Json5Map`, or to neutral `MarshalledMap`, or pass `parser.parse(s,
JsonMap.class)`. |
| Other parsers' `parse(s, Object.class)` → `JsonMap` | → `MarshalledMap` |
Same fix options. |
| `import org.apache.juneau.collections.ResolvingJsonMap;` | `import
org.apache.juneau.collections.ResolvingMarshalledMap;` | Hard rename; update
imports and any `new ResolvingJsonMap(...)` constructor calls. |
@@ -1926,7 +1929,43 @@ If you previously relied on `@Bean` (inject) overriding
a Spring `@Bean`, you ha
- **RestClient `rootUrl`**: The `rootUrl` field is now stored as a
`Supplier<String>` internally. Code that relies on reflection to access the
private `rootUrl` field directly (unusual but possible) will now see a
`Supplier<String>` instead of a `String`.
-### juneau-microservice-core
+### juneau-microservice (formerly juneau-microservice-core)
+
+#### Module Renamed (TODO-36)
+
+The `juneau-microservice-core` Maven artifact has been **renamed** to
`juneau-microservice`. The aggregator pom is now
+`juneau-microservice-parent`. The Java package
`org.apache.juneau.microservice` is unchanged. Update your `pom.xml`:
+
+```xml
+<!-- OLD -->
+<dependency>
+ <groupId>org.apache.juneau</groupId>
+ <artifactId>juneau-microservice-core</artifactId>
+ <version>${juneau.version}</version>
+</dependency>
+
+<!-- NEW -->
+<dependency>
+ <groupId>org.apache.juneau</groupId>
+ <artifactId>juneau-microservice</artifactId>
+ <version>${juneau.version}</version>
+</dependency>
+```
+
+#### `MicroserviceListener` Fan-Out (TODO-36)
+
+`Microservice.start()` / `Microservice.stop()` /
`Microservice.onConfigChange(...)` now invoke **every**
+`MicroserviceListener` bean in the bean store, not just a single resolved
primary listener.
+
+- `onStart` invokes listeners in registration order.
+- `onStop` invokes them in **reverse** registration order.
+
+The builder-supplied `.listener(...)` value is registered into the bean store
under the unnamed key and
+participates in the fan-out like any other `@Bean MicroserviceListener`. If no
listeners are contributed by
+configurations and none is supplied via the builder, the default
`BasicMicroserviceListener` is registered so the
+fan-out always has at least one no-op participant. This change enables
companion modules (notably
+`juneau-microservice-jetty`) to drive server lifecycles entirely through
standard `MicroserviceListener` hooks,
+without needing a `Microservice` subclass.
#### Inject-Aware Microservice (TODO-31)
@@ -1968,26 +2007,60 @@ See <a
href="/docs/topics/MicroserviceCoreInject">Inject-Aware Microservice</a>
### juneau-microservice-jetty
-#### Auto-Discovery of `@Rest` Servlets (TODO-31)
+#### `JettyMicroservice` Replaced by `JettyConfiguration` (TODO-36,
**BREAKING**)
+
+The `JettyMicroservice` subclass, `JettyMicroserviceListener` interface, and
`BasicJettyMicroserviceListener`
+adapter have been **deleted**. `juneau-microservice-jetty` now contributes a
single
+`@Configuration` class — `JettyConfiguration` — that the user adds to
+`Microservice.Builder.configurations(...)` alongside their own application
configuration.
+
+`JettyConfiguration` contributes:
-`JettyMicroservice.createServer()` now consults the bean store for `Servlet`
beans contributed via
-`@Configuration` classes. Any servlet whose runtime class is annotated with
`@Rest` is automatically
-mounted at the path declared by `@Rest(path = "...")` (or `/` when no path is
set).
+- `@Bean @ConditionalOnMissingBean JettyServerFactory` →
`BasicJettyServerFactory`.
+- `@Bean @ConditionalOnMissingBean JettySettings` → empty defaults (ports /
`jetty.xml` content / var
+ resolution can all be overridden by a user-supplied `@Bean JettySettings`).
+- `@Bean JettyServerComponent` — a `MicroserviceListener` that owns the Jetty
server lifecycle.
-**`@Bean`-supplied infrastructure** — when no builder value is set, these
types are resolved from
-the bean store:
+End-state usage:
-- `JettyServerFactory` — replaces `BasicJettyServerFactory` if a custom
factory is contributed.
-- `JettyMicroserviceListener` — replaces the default no-op listener.
-- `org.eclipse.jetty.server.Server` — when present (with
`"ServletContextHandler"` attribute set),
- `createServer()` uses it directly and skips the `jetty.xml` factory step
entirely. Useful for
- tests and fully-code-driven Jetty setups.
+```java
+public class App {
+ public static void main(String[] args) throws Exception {
+ Microservice
+ .create()
+ .args(args)
+ .configurations(JettyConfiguration.class, AppConfig.class)
+ .build()
+ .start()
+ .startConsole()
+ .join();
+ }
+
+ @Configuration
+ public static class AppConfig {
+ @Bean Servlet rootResources() { return new RootResources(); }
+ }
+}
+```
+
+`JettyServerComponent.onStart(...)` mounts servlets contributed by the bean
store (auto-mounting any
+`@Bean Servlet` whose class is annotated with `@Rest` at `@Rest(path =
"...")`), reads the same
+`Jetty/servlets` / `Jetty/servletMap` / `Jetty/servletAttributes` config
sections, and starts the Jetty
+server. `onStop(...)` stops the server in a worker thread.
+
+External callers reach the component via:
+
+```java
+JettyServerComponent jetty = Microservice
+ .getInstance()
+ .getBeanStore()
+ .getBean(JettyServerComponent.class)
+ .orElseThrow();
+```
-**Path-collision enforcement** — `createServer()` now tracks each servlet
pathspec with its
-declaring source and throws a `RuntimeException` with both contributor names
when two servlets claim
-the same path. This covers all sources: `Jetty/servlets`, `Jetty/servletMap`,
`.servlet(...)` builder
-calls, and `@Bean`-discovered servlets. Previously silent collisions are now
hard failures at
-startup.
+**Path-collision enforcement** — `JettyServerComponent.onStart(...)` tracks
each servlet pathspec with its
+declaring source and throws a `RuntimeException` with both contributor names
when two servlets claim the
+same path. This covers all sources: `Jetty/servlets`, `Jetty/servletMap`, and
`@Bean`-discovered servlets.
> **Note on `@Bean` method return types** — declare `@Bean` methods that
> produce a servlet with
> return type `Servlet` (not the concrete subclass). Juneau's
> `BeanStore.getBeansOfType` is
diff --git a/pages/topics/01.01.JuneauEcosystemOverview.md
b/pages/topics/01.01.JuneauEcosystemOverview.md
index d63711a1ed..851f777dc3 100644
--- a/pages/topics/01.01.JuneauEcosystemOverview.md
+++ b/pages/topics/01.01.JuneauEcosystemOverview.md
@@ -27,7 +27,7 @@ The Juneau ecosystem consists of the following parts:
| | [juneau‑rest‑mock](/docs/topics/JuneauRestMockBasics) | REST Testing API |
• Apache HttpClient 4.5 |
| | [juneau‑rest‑server](/docs/topics/JuneauRestServerBasics) | REST Servlet
API | • Servlet 3.1+ |
| |
[juneau‑rest‑server‑springboot](/docs/topics/JuneauRestServerSpringbootBasics)
| REST Spring Boot integration | • Spring Boot 2.0+ |
-| **juneau-microservice** |
[juneau‑microservice‑core](/docs/topics/JuneauMicroserviceCoreBasics) | Core
microservice functionality | • *None* |
+| **juneau-microservice** |
[juneau‑microservice](/docs/topics/JuneauMicroserviceBasics) | Microservice
functionality | • *None* |
| | [juneau‑microservice‑jetty](/docs/topics/JuneauMicroserviceJettyBasics) |
Jetty-based microservice implementation | • Jetty 9.4+ |
| **juneau-petstore** | [juneau‑petstore](/docs/topics/JuneauPetstoreBasics) |
Complete REST application example | • Spring Boot 2.0+ |
| **juneau-examples** |
[juneau‑examples‑core](/docs/topics/JuneauExamplesCore)<br/>[juneau‑examples‑rest](/docs/topics/JuneauExamplesRest)<br/>[juneau‑examples‑rest‑jetty](/docs/topics/JuneauExamplesRestJetty)<br/>[juneau‑examples‑rest‑springboot](/docs/topics/JuneauExamplesRestSpringboot)
| Code examples and tutorials | |
diff --git a/pages/topics/01.02.Marshalling.md
b/pages/topics/01.02.Marshalling.md
index b37af924df..6139de3902 100644
--- a/pages/topics/01.02.Marshalling.md
+++ b/pages/topics/01.02.Marshalling.md
@@ -410,8 +410,8 @@ String myMap =
Json5Map.create().append("foo","bar").toJson5();
String myList = Json5List.of("foo", 123, null, jsonObject).toJson5();
// Parse directly from JSON5 into generic DOMs.
-Map myMap = Json5Map.ofJson5("{foo:'bar'}");
-List myList = Json5List.ofJson5("['foo',123,null]");
+Map myMap = Json5Map.ofText("{foo:'bar'}");
+List myList = Json5List.ofText("['foo',123,null]");
```
Both pairs sit on top of a new neutral <a
href="/site/apidocs/org/apache/juneau/collections/MarshalledMap.html"
target="_blank">MarshalledMap</a> / <a
href="/site/apidocs/org/apache/juneau/collections/MarshalledList.html"
target="_blank">MarshalledList</a> base introduced in v9.5; <a
href="/site/apidocs/org/apache/juneau/collections/JsonMap.html"
target="_blank">JsonMap</a> / <a
href="/site/apidocs/org/apache/juneau/collections/JsonList.html"
target="_blank">JsonList</a> carry the strict [...]
diff --git a/pages/topics/02.23.ObjectTools.md
b/pages/topics/02.23.ObjectTools.md
index 762f2b890c..52c3eb0967 100644
--- a/pages/topics/02.23.ObjectTools.md
+++ b/pages/topics/02.23.ObjectTools.md
@@ -42,7 +42,7 @@ Leaves of the tree can be any type of object.
:::tip Example
```java
// Construct an unstructured POJO model
-JsonMap map = JsonMap.ofJson(""
+JsonMap map = JsonMap.ofText(""
+ "{"
+ " name:'John Smith', "
+ " address:{ "
@@ -91,7 +91,7 @@ johnSmith.post("phoneNumbers", "212 555-3333");
johnSmith.delete("fico score");
// Add entirely new structures to the tree
-JsonMap medicalInfo = JsonMap.ofJson(""
+JsonMap medicalInfo = JsonMap.ofText(""
+ "{"
+ " currentStatus: 'deceased',"
+ " health: 'non-existent',"
diff --git a/pages/topics/14.01.JuneauMicroserviceBasics.md
b/pages/topics/14.01.JuneauMicroserviceBasics.md
new file mode 100644
index 0000000000..c2f4092e09
--- /dev/null
+++ b/pages/topics/14.01.JuneauMicroserviceBasics.md
@@ -0,0 +1,44 @@
+---
+title: "juneau-microservice Basics"
+slug: JuneauMicroserviceBasics
+---
+
+#### Maven Dependency
+
+```xml
+<dependency>
+ <groupId>org.apache.juneau</groupId>
+ <artifactId>juneau-microservice</artifactId>
+ <version>${juneau.version}</version>
+</dependency>
+```
+
+#### Java Library
+
+```text
+juneau-microservice-0.0.0.jar
+```
+
+#### OSGi Module
+
+```text
+org.apache.juneau.microservice_0.0.0.jar
+```
+
+#### Contents/Features
+
+Juneau Microservice is an API for creating stand-alone executable jars with
automatic support for Juneau configurations
+and console commands.
+
+Features include:
+
+- A builder-based API for defining and starting microservices.
+- An extensible API that allows you to hook into various lifecycle events.
+- Simple-to-use APIs for accessing manifest file entries, command-line
arguments, and external configuration file properties.
+- A bean-store-aware inject-style bootstrap (`@Configuration` + `@Bean`) that
lets companion modules — such as `juneau-microservice-jetty` — contribute
servers, listeners, and servlets through standard `@Bean` definitions, rather
than via subclassing.
+
+#### Module Name (Renamed in 9.5)
+
+In 9.5 this module was renamed from `juneau-microservice-core` to
`juneau-microservice`. The Java package
+(`org.apache.juneau.microservice`) is unchanged. See the [V9.5 Migration
Guide](V9.5-migration-guide) for the
+exact dependency update.
diff --git a/pages/topics/14.01.JuneauMicroserviceCoreBasics.md
b/pages/topics/14.01.JuneauMicroserviceCoreBasics.md
deleted file mode 100644
index f75e2b595c..0000000000
--- a/pages/topics/14.01.JuneauMicroserviceCoreBasics.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "juneau-microservice-core Basics"
-slug: JuneauMicroserviceCoreBasics
----
-
-#### Maven Dependency
-
-```xml
-<dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-microservice-core</artifactId>
- <version>${juneau.version}</version>
-</dependency>
-```
-
-#### Java Library
-
-```text
-juneau-microservice-core-0.0.0.jar
-```
-
-#### OSGi Module
-
-```text
-org.apache.juneau.microservice.core_0.0.0.jar
-```
-
-#### Contents/Features
-
-Juneau Microservice is an API for creating stand-alone executable jars with
automatic support for Juneau configurations
-and console commands.
-
-Features include:
-
-- A builder-based API for defining and starting microservices.
-- An extensible API that allows you to hook into various lifecycle events.
-- Simple-to-use APIs for accessing manifest file entries, command-line
arguments, and external configuration file properties.
diff --git a/pages/topics/14.09.InjectAwareMicroservice.md
b/pages/topics/14.09.InjectAwareMicroservice.md
index a5eae46dad..9659c86852 100644
--- a/pages/topics/14.09.InjectAwareMicroservice.md
+++ b/pages/topics/14.09.InjectAwareMicroservice.md
@@ -8,9 +8,10 @@ class is **inject-aware**. Every microservice owns an internal
<a
href="/site/apidocs/org/apache/juneau/commons/inject/WritableBeanStore.html"
target="_blank">WritableBeanStore</a> (accessible via
<a
href="/site/apidocs/org/apache/juneau/microservice/Microservice.html#getBeanStore()"
target="_blank">getBeanStore()</a>),
populated from `@Configuration` classes registered on the builder. Beans
contributed this way
-can be consumed by other `@Bean` factory methods (via constructor injection),
by subclasses
-(e.g. <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.html"
target="_blank">JettyMicroservice</a>
-auto-discovers `@Rest` servlets), and by user code via
`getBeanStore().getBean(...)`.
+can be consumed by other `@Bean` factory methods (via constructor injection),
by companion modules
+(e.g. <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyConfiguration.html"
target="_blank">JettyConfiguration</a>
+contributes a <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerComponent.html"
target="_blank">JettyServerComponent</a>
+that auto-mounts `@Rest` servlets at startup), and by user code via
`getBeanStore().getBean(...)`.
<tree>
<node-0><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/Microservice.Builder.html"
target="_blank">Microservice.Builder</a></java-class></node-0>
@@ -66,14 +67,14 @@ After bootstrap completes, the store contains every bean
registered by your `@Co
| <a href="/site/apidocs/org/apache/juneau/commons/svl/VarResolver.html"
target="_blank">VarResolver</a> | Resolved var resolver with `$A`, `$M`, `$C`
and standard vars wired up. |
| <a
href="/site/apidocs/org/apache/juneau/microservice/MicroserviceListener.html"
target="_blank">MicroserviceListener</a> | Either the builder-supplied
listener, a `@Bean`-supplied one, or the default. |
-In `JettyMicroservice` the store additionally contains:
+When `JettyConfiguration.class` is added to `configurations(...)` the store
additionally contains:
| Type | Notes |
|---|---|
-| <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.html"
target="_blank">JettyMicroservice</a> | The Jetty subclass instance. |
-| <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroserviceListener.html"
target="_blank">JettyMicroserviceListener</a> | Jetty-specific listener. |
+| <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerComponent.html"
target="_blank">JettyServerComponent</a> | Owns the Jetty lifecycle;
participates as a `MicroserviceListener`. |
| <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerFactory.html"
target="_blank">JettyServerFactory</a> | Factory used to build the Jetty
`Server` from `jetty.xml`. |
-| `org.eclipse.jetty.server.Server` | The created Jetty server (after
`createServer()`). |
+| <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettySettings.html"
target="_blank">JettySettings</a> | Programmatic overrides for ports,
`jetty.xml` content, and var resolution. |
+| `org.eclipse.jetty.server.Server` | The created Jetty server (after
`Microservice.start()`). |
## Resolution priority
@@ -89,7 +90,7 @@ always see the same `Args` / `Config` / etc. that
`Microservice.getArgs()` retur
## Discovering `@Rest` servlets in Jetty
-`JettyMicroservice.createServer()` walks the bean store for entries registered
under `Servlet.class`,
+`JettyServerComponent.onStart(...)` walks the bean store for entries
registered under `Servlet.class`,
filters them to those whose runtime class carries `@Rest`, and mounts each one
at the path declared in
`@Rest(path = "...")` (falling back to `/` when no path is set).
@@ -98,10 +99,21 @@ filters them to those whose runtime class carries `@Rest`,
and mounts each one a
public class ApiServlet extends RestServlet { /* ... */ }
@Configuration
-public class JettyConfig {
+public class AppConfig {
@Bean
Servlet apiServlet() { return new ApiServlet(); } // mounted
automatically at /api/*
}
+
+public class App {
+ public static void main(String[] args) throws Exception {
+ Microservice.create()
+ .args(args)
+ .configurations(JettyConfiguration.class, AppConfig.class)
+ .build()
+ .start()
+ .join();
+ }
+}
```
> **Note on declared return types** — Juneau's
> `BeanStore.getBeansOfType(Class)` is exact-type
@@ -111,8 +123,8 @@ public class JettyConfig {
### Path collisions are a hard startup failure
Mounting two servlets at the same pathspec — whether from `Jetty/servlets`,
`Jetty/servletMap`,
-`.servlet(...)` on the builder, or `@Bean` discovery — raises a
`RuntimeException` from
-`createServer()` with a message identifying both contributors:
+or `@Bean` discovery — raises a `RuntimeException` from `Microservice.start()`
with a message
+identifying both contributors:
```
Servlet mount path collision: '/api/*' is already mounted by @Bean ApiServletA;
@@ -122,7 +134,7 @@ refused by @Bean ApiServletB[apiServletDup].
## Bypassing `jetty.xml` entirely
If your `@Configuration` provides a `@Bean Server` whose attribute
`"ServletContextHandler"` is set,
-`createServer()` will skip the `jetty.xml` factory step and use that server
directly:
+`JettyServerComponent` will skip the `jetty.xml` factory step and use that
server directly:
```java
@Configuration
diff --git a/pages/topics/15.02.MicroserviceJettyOverview.md
b/pages/topics/15.02.MicroserviceJettyOverview.md
index 6da311e2fd..c6a4559415 100644
--- a/pages/topics/15.02.MicroserviceJettyOverview.md
+++ b/pages/topics/15.02.MicroserviceJettyOverview.md
@@ -6,33 +6,46 @@ slug: MicroserviceJettyOverview
The Jetty Microservice API consists of a combination of the Juneau Core,
Server, and Client APIs and an embedded Eclipse
Jetty Servlet Container.
-The API builds upon the Core Microservices classes to produce easy-to-create
and easy-to-use microservices in a standard
-Java 1.8+ environment.
+The API builds upon the [juneau-microservice](JuneauMicroserviceBasics)
classes to produce easy-to-create and
+easy-to-use microservices in a standard Java 17+ environment.
+
+> **Renamed in 9.5** — `juneau-microservice-core` is now published as
`juneau-microservice`. The Jetty module is no
+> longer a subclass of `Microservice`; it contributes a single
`@Configuration` class (`JettyConfiguration`) that
+> the user adds to `Microservice.Builder.configurations(...)`.
The `juneau-microservice-jetty` library consists of the following classes:
<tree>
<node-0><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/package-summary.html"
target="_blank">org.apache.juneau.microservice.jetty</a> - Package</node-0>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.html"
target="_blank">JettyMicroservice</a></java-class> - The Jetty microservice
class.</node-1>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html"
target="_blank">JettyMicroservice.Builder</a></java-class> - Builder for the
microservice class.</node-1>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroserviceListener.html"
target="_blank">JettyMicroserviceListener</a></java-class> - Interface for
hooking into lifecyle events of the microservice.</node-1>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/BasicJettyMicroserviceListener.html"
target="_blank">BasicJettyMicroserviceListener</a></java-class> - Adapter for
JettyMicroserviceListener class.</node-1>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerFactory.html"
target="_blank">JettyServerFactory</a></java-class> - Interface for defining
custom Jetty servers.</node-1>
-<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/BasicJettyServerFactory.html"
target="_blank">BasicJettyServerFactory</a></java-class> - Adapter for
JettyServerFactory class.</node-1>
+<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyConfiguration.html"
target="_blank">JettyConfiguration</a></java-class> - <c>@Configuration</c>
class that wires Jetty into a Microservice.</node-1>
+<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerComponent.html"
target="_blank">JettyServerComponent</a></java-class> -
Lifecycle-participating bean that owns the Jetty server.</node-1>
+<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettySettings.html"
target="_blank">JettySettings</a></java-class> - Immutable value bean holding
programmatic Jetty knobs (ports, jetty.xml, var resolution).</node-1>
+<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerFactory.html"
target="_blank">JettyServerFactory</a></java-class> - Interface for defining
custom Jetty server factories.</node-1>
+<node-1><java-class><a
href="/site/apidocs/org/apache/juneau/microservice/jetty/BasicJettyServerFactory.html"
target="_blank">BasicJettyServerFactory</a></java-class> - Default factory
that builds the server from <c>jetty.xml</c>.</node-1>
</tree>
The most-basic creation of a Jetty microservice from an entry-point method is
shown below:
```java
public class App {
- public static void main(String[] args) {
- JettyMicroservice
- .create() // Create builder.
- .args(args) // Pass in args.
- .servlets(RootResource.class) // A Juneau RestServlet class.
- .build() // Create microservice.
- .start() // Start microservice.
- ;
+ public static void main(String[] args) throws Exception {
+ Microservice
+ .create()
+ .args(args)
+ .configurations(JettyConfiguration.class, AppConfig.class)
+ .build()
+ .start()
+ .startConsole()
+ .join();
+ }
+
+ @Configuration
+ public static class AppConfig {
+ @Bean
+ Servlet rootResources() { return new RootResources(); }
}
}
```
+
+`RootResources` (or any `@Bean Servlet` whose class is annotated with `@Rest`)
is auto-mounted at the
+path declared in `@Rest(path = "...")`.
diff --git a/pages/topics/15.04.ResourceClasses.md
b/pages/topics/15.04.ResourceClasses.md
index ae6a30ec52..b02814f710 100644
--- a/pages/topics/15.04.ResourceClasses.md
+++ b/pages/topics/15.04.ResourceClasses.md
@@ -68,27 +68,36 @@ public class HelloWorldResource extends BasicRestServlet {
```
-The most-common case for deploying the top-level resource is to use the <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html#servlet(java.lang.Class)"
target="_blank">JettyMicroservice.Builder.servlet(Class)</a> method:
+The most-common case for deploying the top-level resource is to expose it as a
`@Bean Servlet` in an
+application `@Configuration` class. `JettyServerComponent` discovers all
`@Bean Servlet` instances at
+start-up and auto-mounts any whose class is annotated with `@Rest` at
`@Rest(path="...")`:
```java
public class App {
- public static void main(String[] args) {
- JettyMicroservice
+ public static void main(String[] args) throws Exception {
+ Microservice
.create()
.args(args)
- .servlet(RootResources.class) // Our root resource.
+ .configurations(JettyConfiguration.class, AppConfig.class)
.build()
.start()
- ;
+ .startConsole()
+ .join();
+ }
+
+ @Configuration
+ public static class AppConfig {
+ @Bean
+ Servlet rootResources() { return new RootResources(); }
}
}
```
-However, there are multiple ways of deploying top-level resources:
+However, there are multiple ways of deploying top-level resources:
-- <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html#servlet(java.lang.Class)"
target="_blank">JettyMicroservice.Builder.servlet(Class)</a> - Using the
builder. Several methods provided.
-- <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.html#addServlet(jakarta.servlet.Servlet,java.lang.String)"
target="_blank">JettyMicroservice.addServlet(Servlet,String)</a> - After the
Jetty container has been started.
+- `@Bean Servlet` in a user `@Configuration` — auto-mounted at
`@Rest(path=...)`.
+- <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyServerComponent.html#addServlet(jakarta.servlet.Servlet,java.lang.String)"
target="_blank">JettyServerComponent.addServlet(Servlet,String)</a> - after
the Jetty container has been started.
- As a configuration variable `Jetty/servlets`.
```ini
diff --git a/pages/topics/15.07.JettyXml.md b/pages/topics/15.07.JettyXml.md
index e90211a2ae..938327d2c5 100644
--- a/pages/topics/15.07.JettyXml.md
+++ b/pages/topics/15.07.JettyXml.md
@@ -9,15 +9,28 @@ The `jetty.xml` can be located in either the `.` or `files`
working directory or
It can also be specified in any of the following ways:
-- Using the <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html#jettyXml(java.lang.Object,boolean)"
target="_blank">JettyMicroservice.Builder.jettyXml(Object,boolean)</a> method
to specify the location or contents of the file.
+- Supplying a `@Bean JettySettings` whose `jettyXml(Object, boolean
resolveVars)` builder method sets the
+ raw XML contents (and optionally requests SVL var-resolution).
+
+```java
+@Configuration
+public class MyJettyConfig {
+ @Bean
+ JettySettings jettySettings() {
+ return JettySettings.create()
+ .jettyXml(myXmlReader, true)
+ .build();
+ }
+}
+```
+
- Specifying the location using a `Jetty-Config` value in the `MANIFEST.MF`
file.
```ini
Jetty-Config: files/jetty.xml
```
-
-- Specifying the location using the "Jetty/jettyXml" configuration value.
+- Specifying the location using the "Jetty/config" configuration value.
```ini
#=======================================================================================================================
@@ -31,25 +44,27 @@ Jetty-Config: files/jetty.xml
config = files/jetty.xml
```
-
-SVL variables in the `jetty.xml` file are automatically resolved by the
microservice.
+SVL variables in the `jetty.xml` file can be automatically resolved by the
microservice when the
+`Jetty/resolveVars=true` config flag is set (or via
`JettySettings.jettyXml(..., true)`).
This allows you to reference values in your configuration file from the
`jetty.xml` file.
+
The HTTP port used is controlled via the following:
-- The <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html#ports(int...)"
target="_blank">JettyMicroservice.Builder.ports(int...)</a> method.
+- Supplying a `@Bean JettySettings` whose `ports(int...)` builder method
specifies a list of candidate ports.
```java
-JettyMicroservice
- .create()
- .args(args)
- .servlets(RootResource.class)
- .port(1000,2000,0,0,0) // Try port 1000, then 2000, then 3 random ports.
- .build()
- .start()
+@Configuration
+public class MyJettyConfig {
+ @Bean
+ JettySettings jettySettings() {
+ return JettySettings.create()
+ .ports(1000, 2000, 0, 0, 0) // Try port 1000, then 2000, then 3
random ports.
+ .build();
+ }
+}
```
-
-- The "Jetty/ports" configuration property.
+- The "Jetty/port" configuration property.
```ini
#=======================================================================================================================
@@ -64,9 +79,8 @@ JettyMicroservice
port = 1000,2000,0,0,0
```
-
The first available port is then made available through the system property
"availablePort" so that it can be referenced
-in our `jetty.xml` file.
+in your `jetty.xml` file.
```xml
<Set name="connectors">
@@ -83,5 +97,5 @@ in our `jetty.xml` file.
</Set>
```
-
-The <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html#jettyServerFactory(org.apache.juneau.microservice.jetty.JettyServerFactory)"
target="_blank">JettyMicroservice.Builder.jettyServerFactory(JettyServerFactory)</a>
method is also provided to use your own customized Jetty server.
+A `@Bean JettyServerFactory` can also be supplied (or contributed by
`JettyConfiguration` as its default)
+to fully control how the `Server` is built from the resolved XML.
diff --git a/pages/topics/15.09.Extending.md b/pages/topics/15.09.Extending.md
index db13e03b16..ff360a42f5 100644
--- a/pages/topics/15.09.Extending.md
+++ b/pages/topics/15.09.Extending.md
@@ -1,77 +1,77 @@
---
-title: "Extending JettyMicroservice"
+title: "Customizing via @Bean"
slug: Extending
---
-This example shows how the <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.html"
target="_blank">JettyMicroservice</a>
-class can be extended to implement lifecycle listener methods or override
existing methods.
-We'll create a new class `com.foo.MyJettyMicroservice`.
+In 9.5 `JettyMicroservice` was retired — `juneau-microservice-jetty` now
contributes a single
+[JettyConfiguration](MicroserviceJettyOverview) class that wires Jetty into
the standard
+[Microservice](JuneauMicroserviceBasics). Customization is therefore done by
**contributing your own
+`@Bean` definitions** rather than subclassing.
-```java
-/**
-* Sample subclass of a JettyMicroservice that provides customized behavior.
-*/
-public class MyJettyMicroservice extends JettyMicroservice {
-
- public static void main(String[] args) throws Exception {
- JettyMicroservice.Builder builder = JettyMicroservice.create();
- new MyJettyMicroservice(builder).start().join();
- }
+#### Hooking into the lifecycle
- public MyJettyMicroservice(JettyMicroservice.Builder builder) throws
Exception {
- super(builder);
- }
-
- // Customized code here.
-```
-
-Optionally, you can extend the <a
href="/site/apidocs/org/apache/juneau/microservice/jetty/JettyMicroservice.Builder.html"
target="_blank">JettyMicroservice.Builder</a> class as well:
+Implement [`MicroserviceListener`](MicroserviceCoreListeners) and expose it as
a `@Bean` — every
+`MicroserviceListener` bean in the store is invoked on `start()` / `stop()` /
config-change events
+(start in registration order, stop in reverse order).
```java
-public class MyJettyMicroservice.Builder extends JettyMicroservice.Builder {
-
- int extraField;
-
- /**
- * Constructor (required).
- */
- protected MyJettyMicroservice.Builder() {}
-
- /**
- * Copy constructor (required).
- *
- * @param copyFrom The builder to copy settings from.
- */
- protected MyJettyMicroservice.Builder(MyJettyMicroservice.Builder
copyFrom) {
- super(copyFrom);
+@Configuration
+public class MyApp {
+
+ @Bean
+ Servlet rootResources() { return new RootResources(); }
+
+ @Bean(name = "lifecycle")
+ MicroserviceListener lifecycle() {
+ return new BasicMicroserviceListener() {
+ @Override
+ public void onStart(Microservice ms) {
+ // custom start-up logic, e.g. warming caches, registering JMX
beans, etc.
+ }
+ @Override
+ public void onStop(Microservice ms) {
+ // custom shutdown logic
+ }
+ };
}
+}
- // Additional setters
-
- public MyJettyMicroservice.Builder extraField(int extraField) {
- this.extraField = extraField;
- return this;
+public class App {
+ public static void main(String[] args) throws Exception {
+ Microservice
+ .create()
+ .args(args)
+ .configurations(JettyConfiguration.class, MyApp.class)
+ .build()
+ .start()
+ .startConsole()
+ .join();
}
+}
+```
- // Overridden methods
+#### Overriding Jetty defaults
- @Override /* JettyMicroservice.Builder */
- public MyJettyMicroservice.Builder copy() {
- return new MyJettyMicroservice.Builder(this);
- }
+The relevant Jetty hooks are all keyed by **bean type** in the store;
user-supplied `@Bean`s win over the
+defaults that `JettyConfiguration` contributes.
- @Override /* JettyMicroservice.Builder */
- public MyJettyMicroservice.Builder ports(int...ports) {
- super.ports(ports);
- return this;
- }
+| Override | Replace by contributing |
+|---|---|
+| Jetty server itself | `@Bean Server` (skips `jetty.xml` entirely if its
`"ServletContextHandler"` attribute is set). |
+| Server factory | `@Bean JettyServerFactory` — used when no `@Bean Server` is
supplied. |
+| Ports / `jetty.xml` content / var resolution | `@Bean JettySettings` (use
`JettySettings.create().ports(...).jettyXml(...).build()`). |
+| Servlet auto-mounts | `@Bean Servlet`s annotated with `@Rest` — mounted at
`@Rest(path = "...")`. |
- @Override /* JettyMicroservice.Builder */
- public MyJettyMicroservice.Builder servlet(Class cls) throws
InstantiationException, IllegalAccessException {
- super.servlet(cls);
- return this;
- }
+#### Accessing the Jetty server at runtime
- ...
-}
+```java
+JettyServerComponent jetty = Microservice
+ .getInstance()
+ .getBeanStore()
+ .getBean(JettyServerComponent.class)
+ .orElseThrow();
+
+URI uri = jetty.getURI();
+int port = jetty.getPort();
+Server server = jetty.getServer();
```
diff --git a/pages/topics/20.06.JuneauShadedAll.md
b/pages/topics/20.06.JuneauShadedAll.md
index 8020a35fc8..e54fab28e3 100644
--- a/pages/topics/20.06.JuneauShadedAll.md
+++ b/pages/topics/20.06.JuneauShadedAll.md
@@ -33,7 +33,7 @@ This artifact includes **everything**:
- **juneau-bean-swagger-v2** - Swagger 2.0 beans
### Microservice Modules
-- **juneau-microservice-core** - Core microservice functionality
+- **juneau-microservice** - Microservice functionality
- **juneau-microservice-jetty** - Jetty-based microservice
## Use Cases
@@ -376,6 +376,6 @@ All imports and API usage remain exactly the same!
- **[REST Server Basics](/docs/topics/JuneauRestServerBasics)** - Build REST
APIs
- **[REST Client Basics](/docs/topics/JuneauRestClientBasics)** - Consume REST
APIs
- **[Marshalling Basics](/docs/topics/JuneauMarshallBasics)** -
Serialize/deserialize objects
-- **[Microservice Basics](/docs/topics/JuneauMicroserviceCoreBasics)** - Build
microservices
+- **[Microservice Basics](/docs/topics/JuneauMicroserviceBasics)** - Build
microservices
- **[Spring Boot Integration](/docs/topics/SpringBootOverview)** - Use with
Spring Boot
diff --git a/pages/topics/23.01.V9.5-migration-guide.md
b/pages/topics/23.01.V9.5-migration-guide.md
index 81f7add687..c3da890cd0 100644
--- a/pages/topics/23.01.V9.5-migration-guide.md
+++ b/pages/topics/23.01.V9.5-migration-guide.md
@@ -59,8 +59,10 @@ flavored maps / lists based on the parser's language, which
changes the runtime
|-----|-----|-------|
| `JsonMap#toString()` returned JSON5 (via `Json5.of(this)`). | Returns strict
RFC 8259 JSON (via `Json.of(this)`). | Callers that want JSON5 output should
switch to `Json5Map` (or call `Json5.of(map)` explicitly). On `JsonMap` itself,
`toJson5()` still returns JSON5 — only `toString()` changed. |
| `JsonList#toString()` returned JSON5. | Returns strict JSON. | Same advice —
switch to `Json5List`, or call `Json5.of(list)` / `list.toJson5()`. |
-| `new JsonMap(CharSequence)` / `new JsonMap(Reader)` /
`JsonMap.ofJson(CharSequence)` defaulted to `Json5Parser.DEFAULT`. | Default to
`JsonParser.DEFAULT`. | Callers feeding JSON5-with-unquoted-keys text into the
bare constructor will now throw `ParseException`. Either: (1) switch to `new
Json5Map(CharSequence)` / `Json5Map.ofJson5(...)`, or (2) pass an explicit
`Json5Parser.DEFAULT` to `MarshalledMap.ofText(text, Json5Parser.DEFAULT)`. |
-| `new JsonList(CharSequence)` / `new JsonList(Reader)` /
`JsonList.ofJson(CharSequence)` defaulted to `Json5Parser.DEFAULT`. | Default
to `JsonParser.DEFAULT`. | Same change, same advice — switch to `Json5List` /
`Json5List.ofJson5(...)`, or pass an explicit `Json5Parser.DEFAULT` to
`MarshalledList.ofText(...)`. |
+| `new JsonMap(CharSequence)` / `new JsonMap(Reader)` /
`JsonMap.ofJson(CharSequence)` defaulted to `Json5Parser.DEFAULT`. | Default to
`JsonParser.DEFAULT`. The single-arg `ofJson(...)` factory was also renamed to
`ofText(...)`. | Callers feeding JSON5-with-unquoted-keys text into the bare
constructor will now throw `ParseException`. Either: (1) switch to `new
Json5Map(CharSequence)` / `Json5Map.ofText(...)`, or (2) pass an explicit
`Json5Parser.DEFAULT` to `MarshalledMap.ofText(text, J [...]
+| `new JsonList(CharSequence)` / `new JsonList(Reader)` /
`JsonList.ofJson(CharSequence)` defaulted to `Json5Parser.DEFAULT`. | Default
to `JsonParser.DEFAULT`. The single-arg `ofJson(...)` factory was also renamed
to `ofText(...)`. | Same change, same advice — switch to `Json5List` /
`Json5List.ofText(...)`, or pass an explicit `Json5Parser.DEFAULT` to
`MarshalledList.ofText(...)`. Call sites of `JsonList.ofJson(...)` should be
renamed to `JsonList.ofText(...)`. |
+| `Json5Map.ofJson5(CharSequence)` / `Json5Map.ofJson5(Reader)` |
`Json5Map.ofText(CharSequence)` / `Json5Map.ofText(Reader)` | Method renamed
for consistency with `MarshalledMap.ofText(...)`. No behavioral change — the
single-arg form still uses `Json5Parser.DEFAULT`. |
+| `Json5List.ofJson5(CharSequence)` / `Json5List.ofJson5(Reader)` |
`Json5List.ofText(CharSequence)` / `Json5List.ofText(Reader)` | Method renamed
for consistency with `MarshalledList.ofText(...)`. No behavioral change — the
single-arg form still uses `Json5Parser.DEFAULT`. (Note:
`Json5List.ofJson5OrCdl(String)` was NOT renamed.) |
| `Json5Parser.DEFAULT.parse(s, Object.class)` returned a `JsonMap` (and
nested objects were `JsonMap` / `JsonList`). | Returns a `Json5Map` (and nested
objects are `Json5Map` / `Json5List`). | Same change applies to `parse(s,
Map.class)` / `parse(s, Collection.class)` targets, and to nested maps / lists
inside the parsed tree. Code that casts the result to `JsonMap` will throw
`ClassCastException`. Fix options: (1) cast to `Json5Map` / `Json5List`
instead, (2) cast to the neutral `Marsh [...]
| Every parser other than `JsonParser` / `Json5Parser` (`XmlParser`,
`YamlParser`, `UonParser`, `UrlEncodingParser`, `HoconParser`, `MsgPackParser`,
`CborParser`, `BsonParser`, `HtmlParser`, `JsonlParser`, `HjsonParser`,
`MarkdownParser`, `CsvParser`, `RdfXmlParser`, etc.) returned `JsonMap` /
`JsonList` from `parse(s, Object.class)`. | Returns the neutral `MarshalledMap`
/ `MarshalledList`. | Same fix options as the `Json5Parser` row above.
Per-language flavored `XMap` / `XList` (e.g. ` [...]
| `org.apache.juneau.collections.ResolvingJsonMap` |
`org.apache.juneau.collections.ResolvingMarshalledMap` | Renamed AND
re-parented from `JsonMap` to the new neutral `MarshalledMap` base — SVL
resolution is language-agnostic. Hard rename, no deprecation shim. Update the
import and any `new ResolvingJsonMap(...)` constructor calls. |
@@ -255,5 +257,23 @@ The `org.apache.juneau.commons.inject` package now exposes
a JSR-330–aligned i
| `@Bean` had only `name()` / `value()` / `methodScope()` / `description()`. |
New `int priority() default Integer.MAX_VALUE/2;` attribute provides bean
ordering when `@Order` is absent. | Existing usages unchanged; the attribute
defaults to mid-range so previously-unordered collections retain stable
behavior. |
| n/a | `WritableBeanStore.registerConfiguration(Class)` /
`registerConfigurations(Class...)` register a `@Configuration` class,
recursively processing `imports`, deduplicating across calls, inheriting
`@Bean` members from superclasses (parent-first), and honoring `@Conditional`
annotations at both class and member level. | Duplicate `(type, name)`
registrations throw `BeanCreationException`. Class-level conditional failures
cascade — the configuration and its imports are silently skipped. |
+## Microservice + Jetty Refactor (TODO-36)
+
+`juneau-microservice-core` has been renamed to `juneau-microservice`, and
`juneau-microservice-jetty` no
+longer subclasses `Microservice`. The Jetty module now contributes a single
`JettyConfiguration` class that
+the user adds to `Microservice.Builder.configurations(...)`. The Java package
+`org.apache.juneau.microservice` is unchanged.
+
+| Old | New | Notes |
+|-----|-----|-------|
+| `<artifactId>juneau-microservice-core</artifactId>` |
`<artifactId>juneau-microservice</artifactId>` | Module rename. Aggregator pom
is now `juneau-microservice-parent`. Update every consumer pom. |
+|
`JettyMicroservice.create().args(args).servlet(MyResource.class).build().start()`
| `Microservice.create().args(args).configurations(JettyConfiguration.class,
AppConfig.class).build().start()` where `AppConfig` exposes `@Bean Servlet
rootResources() { return new MyResource(); }` | `JettyMicroservice` (subclass)
deleted; the Jetty server is now driven by `JettyServerComponent`, a
`MicroserviceListener` contributed by `JettyConfiguration`. |
+| `class MyJettyMicroservice extends JettyMicroservice { ... }` | Contribute a
`@Bean MicroserviceListener` from your `@Configuration` class. | The fanned-out
`MicroserviceListener` invocation makes subclassing unnecessary. |
+| `JettyMicroserviceListener` / `BasicJettyMicroserviceListener` |
`MicroserviceListener` / `BasicMicroserviceListener` | Jetty-specific listener
interface deleted. Every `MicroserviceListener` bean is invoked on `start()` /
`stop()` / config-change events. |
+| `JettyMicroservice.Builder.ports(int...)` / `.jettyXml(Object, boolean)` /
`.jettyServerFactory(...)` | Contribute a `@Bean JettySettings` (with
`.ports(...)` / `.jettyXml(..., resolveVars)`) and/or a `@Bean
JettyServerFactory`. | All Jetty programmatic knobs migrate from
`JettyMicroservice.Builder` setters to value beans. |
+| `JettyMicroservice.Builder.servlet(...)` / `.servletAttribute(...)` | `@Bean
Servlet` (auto-mounted at `@Rest(path=...)`) / `Jetty/servletAttributes` config
section. | The Jetty-specific builder surface is gone — use the bean store /
standard config sections instead. |
+| `JettyMicroservice.getInstance().getServer()` |
`Microservice.getInstance().getBeanStore().getBean(JettyServerComponent.class).orElseThrow().getServer()`
| Same for `.getPort()`, `.getURI()`, `.getContextPath()`,
`.getServletContextHandler()`. |
+| `JettyMicroservice.Builder.listener(JettyMicroserviceListener)` |
`Microservice.Builder.listener(MicroserviceListener)` or `@Bean
MicroserviceListener` | The builder listener is registered into the bean store
as the unnamed entry and participates in fan-out alongside `@Bean`-supplied
listeners. |
+
<!-- Additional rows will be populated as 9.5 breaking changes land. See
todo/TODO-17 for the
ongoing 9.5.0 audit. -->
diff --git a/sidebars.ts b/sidebars.ts
index 665775e87c..243bb19406 100644
--- a/sidebars.ts
+++ b/sidebars.ts
@@ -1705,18 +1705,18 @@ const sidebars: SidebarsConfig = {
},
{
type: 'category',
- label: '14. juneau-microservice-core',
+ label: '14. juneau-microservice',
collapsed: true,
items: [
{
type: 'doc',
- id:
'topics/14.01.JuneauMicroserviceCoreBasics',
- label: '14.1.
juneau-microservice-core Basics',
+ id:
'topics/14.01.JuneauMicroserviceBasics',
+ label: '14.1.
juneau-microservice Basics',
},
{
type: 'doc',
id:
'topics/14.02.MicroserviceCoreOverview',
- label: '14.2.
Microservice Core Overview',
+ label: '14.2.
Microservice Overview',
},
{
type: 'doc',
@@ -1803,7 +1803,7 @@ const sidebars: SidebarsConfig = {
{
type: 'doc',
id:
'topics/15.09.Extending',
- label: '15.9.
Extending',
+ label: '15.9.
Customizing via @Bean',
},
],
},
diff --git a/src/pages/downloads.md b/src/pages/downloads.md
index abec887fa4..5f7be6e2d7 100644
--- a/src/pages/downloads.md
+++ b/src/pages/downloads.md
@@ -91,7 +91,7 @@
<artifactId>juneau-rest-server</artifactId>
<artifactId>juneau-rest-server-springboot</artifactId>
<!-- Microservice modules -->
-<artifactId>juneau-microservice-core</artifactId>
+<artifactId>juneau-microservice</artifactId>
<artifactId>juneau-microservice-jetty</artifactId>
<!-- Shaded modules -->
<artifactId>juneau-shaded-core</artifactId>