nrknithin opened a new pull request, #2210:
URL: https://github.com/apache/incubator-kie-kogito-examples/pull/2210

   Kie-Issue: https://github.com/apache/incubator-kie-issues/issues/2288
   
   Related PRs
   - Drools: https://github.com/apache/incubator-kie-drools/pull/6686
   - Optaplanner: https://github.com/apache/incubator-kie-optaplanner/pull/3221
   - Kogito Runtimes: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4270
   - Kogito Apps: https://github.com/apache/incubator-kie-kogito-apps/pull/2331
   
   ### Summary
   Migrate kogito-examples' Spring Boot examples from **Spring Boot 3.5.x → 
4.0.5** (inherited via `kogito-build-no-bom-parent`). Covers all 38+ Spring 
Boot example modules + the two Spring Boot Gradle examples. Quarkus example 
modules absorb the Hibernate / graphql-java / Netty bumps via the shared 
kogito-dependencies-bom but otherwise unchanged.
   
   ### What changed
   
   **SB 4 module-split adaptations (Java imports)**
   - `EntityScan`, `CacheMetricsAutoConfiguration`, `RestTemplateBuilder` — 
relocated in SB 4.0 to new artifacts (`spring-boot-persistence`, 
`spring-boot-cache`, `spring-boot-restclient`). Imports updated in 4 source 
files; matching `spring-boot-cache` / `spring-boot-restclient` deps added to 
`onboarding-springboot`, `process-decisions-rest-springboot`, 
`process-rest-service-call-springboot` poms.
   - `@AutoConfigureObservability` — **removed** in SB 4; observability 
auto-config is on by default in tests. Annotation + import dropped from 4 test 
classes (`DashboardsListTest`, `DroolsMetricsTest`, `LoanEligibilityTest`, 
`ProcessMetricsTest`).
   - Spring Cloud Kubernetes 5 renamed `Kubernetes*AutoConfiguration` → 
`Fabric8*AutoConfiguration` (Fabric8 vs Kubernetes-Client variants in the same 
package). `KogitoOnboardingApplication`'s `@SpringBootApplication(exclude = …)` 
updated accordingly.
   - Spring Security 7 removed the chained `HttpSecurity` DSL. Two 
`DefaultWebSecurityConfig` classes migrated to the lambda DSL 
(`process-usertasks-with-security-springboot`, 
`process-usertasks-with-security-oidc-springboot`).
   
   **Netty 4.1 (Quarkus) vs 4.2 (SB) split**
   - `kogito-springboot-examples/pom.xml`: added 
`<version.io.netty>4.2.12.Final</version.io.netty>` + per-artifact pins for the 
11 netty-* artifacts SB transitively pulls in. Mirrors the existing block in 
`3-kogito-runtimes/springboot/pom.xml`. Without this, Infinispan 15.x's Hot Rod 
client throws `NoClassDefFoundError: io/netty/channel/IoHandle` (Netty 4.2-only 
class) on the SB side because the shared `kogito-dependencies-bom` keeps Netty 
on the 4.1.x line for Quarkus / Vert.x 4.5.x compatibility. Centralizing the 
pins in `kogito-spring-boot-bom` was attempted but does not work — 
parent-chain-imported BOM entries (kogito-dependencies-bom Netty 4.1) beat 
module-imported BOM entries via Maven's first-wins rule.
   
   **Spring Boot 4 / Infinispan transition shim**
   - 
`process-infinispan-persistence-springboot/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java`:
 empty stub class at the legacy SB 3 FQN. 
`org.infinispan:infinispan-spring-boot3-starter-remote:15.2.6.Final` still 
declares `@AutoConfigureBefore(CacheAutoConfiguration.class)` against the old 
FQN; SB 4 relocated it. Mirrors the same stub already present in 
3-kogito-runtimes' SB Infinispan IT module.
   
   **Jackson 2 transition shims (SB 4 only auto-configures Jackson 3 
ObjectMapper)**
   - 
`onboarding-springboot/src/main/java/org/kie/kogito/examples/JacksonHttpMessageConverterConfig.java`:
 local `@Bean MappingJackson2HttpMessageConverter` with `canWrite(String) → 
false` override. Onboarding has no rule units (so no codegen-generated 
`RestObjectMapper` to provide it), and its `payroll.paymentDate` JSON-path 
assertion expects the local-timezone format produced by the Jackson 2 
ObjectMapper (Jackson 3 default writes UTC `Z`). The `canWrite` override on 
`String.class` lets pre-serialized String response bodies flow through Spring's 
`StringHttpMessageConverter` instead of being JSON-quoted by Jackson 2.
   - Upstream codegen change (in this PR's *Related PRs*): 
`RestObjectMapperSpringTemplate` in drools now registers the same `@Bean 
MappingJackson2HttpMessageConverter` for rule-unit modules, so DMN+rule-unit 
examples (e.g. `dmn-drools-springboot-metrics`, 
`decisiontable-springboot-example`, `ruleunit-springboot-example`) get it via 
codegen.
   
   **Gradle examples (two modules)**
   - `springBootVersion` `3.5.12` → `4.0.5` in both Gradle modules' 
`gradle.properties` (was producing `cannot find symbol: method 
asMultiValueMap()` on the codegen-generated REST resource — codegen targets 
Spring 7 / SB 4 but Gradle was still on SB 3).
   - `ext['groovy.version'] = '4.0.29'` added to both `build.gradle` files. SB 
4.0.5 ships Groovy 5.0.4 via spring-boot-dependencies, but RestAssured 5.5.6 
(managed by `kogito-dependencies-bom`) was compiled against Groovy 4 and throws 
`NullPointerException` in `MetaClassImpl.getMetaProperty` under Groovy 5. 
Aligns the Gradle classpath with the Maven side (which pins Groovy 4.0.29 in 
`kogito-spring-boot-bom`).
   
   ### Why no Jackson 3 migration here
   Same constraint as kogito-runtimes / kogito-apps: `kogito-events-core`'s 
`JacksonEventDataUnmarshaller` exposes 
`com.fasterxml.jackson.databind.ObjectMapper` and is shared between the SB and 
Quarkus sides. One-side migration forces the other; out of scope until the 
planned `kogito-dependencies-bom` split (common / springboot / quarkus) lands. 
The Jackson 2 converter shims (onboarding's local `@Bean` + the codegen 
template) are tagged with `TODO Jackson 3 migration`.
   
   Verified with full `mvn clean install` — all 123/123 modules pass.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to