Skip to content

Commit

Permalink
feat(starter): Spring Boot 3.1 support
Browse files Browse the repository at this point in the history
* use engine-spring-6
* removed deprecated Spring Boot 2 code
* use AutoConfiguration.imports
* webjar: use webapps-jakarta
* use -jakarta modules for rest, webapp, invoice
* javax -> jakarta imports
* Spring Boot 3.1
  * pin httpClient to 4.5.14 version
  * pin mockito version
* integration test adjustments
  * fix RequestScopeIT setup:
    * remove internal-dependencies from
    dependencyManagement as our logback dependencies version cause conflict
    with those coming from Spring Boot. And the test uses CapturedOutput
    that is Spring Boot implementation using dependencies with high version
    than the defined in internal-dependencies
  * RestIT workaround
    * use APPLICATION_HAL_JSON instead of APPLICATION_HAL_JSON_TYPE field
  * LoginIT: bump selenium version
* starter can be built with JDK17+
* manage webapp-jakarta dependency through bom
* ensure assert can be used JDK 11
  * add junit-platform-launcher dependency
  * and bump the assertj and junit5 versions in camunda-bpm-junit5 and
  camunda-dmn-junit5 modules aligned with the ones in Assert

Related to camunda#3441
  • Loading branch information
yanavasileva committed Jun 30, 2023
1 parent 0e3639e commit 6b2e2f2
Show file tree
Hide file tree
Showing 85 changed files with 191 additions and 152 deletions.
6 changes: 2 additions & 4 deletions .ci/config/stage-types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ platform-jdk-openjdk-jdk-11-latest:
!spring-boot-starter/starter-qa/integration-test-webapp/runtime,
!distro/run,!distro/run/assembly,!distro/run/core,!distro/run/distro,!distro/run/modules,!distro/run/modules/example,
!distro/run/modules/rest,!distro/run/modules/swaggerui,!distro/run/modules/webapps,!distro/run/qa,!distro/run/qa/integration-tests,
!distro/run/qa/runtime,
!test-utils/assert,!test-utils/assert/core,!test-utils/assert/qa''
!distro/run/qa/runtime''
-Pdistro,distro-ce,distro-wildfly'
stash:
runtimeStash: true
Expand Down Expand Up @@ -187,8 +186,7 @@ platform-jdk-jdk-11-latest:
!spring-boot-starter/starter-qa/integration-test-webapp/runtime,
!distro/run,!distro/run/assembly,!distro/run/core,!distro/run/distro,!distro/run/modules,!distro/run/modules/example,
!distro/run/modules/rest,!distro/run/modules/swaggerui,!distro/run/modules/webapps,!distro/run/qa,!distro/run/qa/integration-tests,
!distro/run/qa/runtime,
!test-utils/assert,!test-utils/assert/core,!test-utils/assert/qa''
!distro/run/qa/runtime''
-Pdistro,distro-ce,distro-wildfly'
stash:
runtimeStash: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-dependency-tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- uses: camunda/java-dependency-tree-diff@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,26 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp-jakarta</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp-jakarta</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp-webjar-ee</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions distro/webjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependencies>
<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp</artifactId>
<artifactId>camunda-webapp-jakarta</artifactId>
<version>${project.parent.version}</version>
<type>jar</type>
<classifier>classes</classifier>
Expand All @@ -58,7 +58,7 @@
<artifactItems>
<artifactItem>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp</artifactId>
<artifactId>camunda-webapp-jakarta</artifactId>
<version>${project.parent.version}</version>
<type>war</type>
<overWrite>true</overWrite>
Expand Down
3 changes: 2 additions & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<version.quarkus>3.1.1.Final</version.quarkus>
<version.spring.framework>5.3.27</version.spring.framework>
<version.spring.framework6>6.0.9</version.spring.framework6>
<version.spring-boot>2.7.12</version.spring-boot>
<version.spring-boot>3.1.1</version.spring-boot>
<version.resteasy>3.15.6.Final</version.resteasy>
<version.jersey2>2.34</version.jersey2>
<!-- use minimum version of resteasy and jersey -->
Expand All @@ -37,6 +37,7 @@
<version.xml.bind-api>2.3.3</version.xml.bind-api>
<version.xml.jaxb-impl>2.3.6</version.xml.jaxb-impl>
<version.snakeyaml>1.33</version.snakeyaml>
<version.httpclient>4.5.14</version.httpclient>

<version.slf4j>1.7.26</version.slf4j>
<version.logback>1.2.11</version.logback>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class RestIT extends AbstractWebIntegrationTest {
private static final String HISTORIC_DETAIL_PATH = ENGINE_DEFAULT_PATH + "/history/detail";

private static final String PROCESS_INSTANCE_PATH = ENGINE_DEFAULT_PATH + "/process-instance";

private static final String SCHEMA_LOG_PATH = ENGINE_DEFAULT_PATH + "/schema/log";


Expand Down Expand Up @@ -302,17 +302,17 @@ protected JSONObject getFirstHistoricVariableUpdates() throws JSONException {

protected void assertMediaTypesOfResource(String resourcePath, boolean postSupported) {
WebResource resource = client.resource(resourcePath);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE, MediaType.WILDCARD);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON);
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON_TYPE, Hal.APPLICATION_HAL_JSON);
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON_TYPE, Hal.APPLICATION_HAL_JSON, MediaType.APPLICATION_JSON + "; q=0.5");
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE, Hal.APPLICATION_HAL_JSON + "; q=0.5", MediaType.APPLICATION_JSON);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE, Hal.APPLICATION_HAL_JSON + "; q=0.5 ", MediaType.APPLICATION_JSON + "; q=0.6");
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON_TYPE, Hal.APPLICATION_HAL_JSON + "; q=0.6", MediaType.APPLICATION_JSON + "; q=0.5");
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE.getType());
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE.getType(), MediaType.WILDCARD);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE.getType(), MediaType.APPLICATION_JSON);
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON, Hal.APPLICATION_HAL_JSON);
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON, Hal.APPLICATION_HAL_JSON, MediaType.APPLICATION_JSON + "; q=0.5");
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE.getType(), Hal.APPLICATION_HAL_JSON + "; q=0.5", MediaType.APPLICATION_JSON);
assertMediaTypes(resource, postSupported, MediaType.APPLICATION_JSON_TYPE.getType(), Hal.APPLICATION_HAL_JSON + "; q=0.5 ", MediaType.APPLICATION_JSON + "; q=0.6");
assertMediaTypes(resource, postSupported, Hal.APPLICATION_HAL_JSON, Hal.APPLICATION_HAL_JSON + "; q=0.6", MediaType.APPLICATION_JSON + "; q=0.5");
}

protected void assertMediaTypes(WebResource resource, boolean postSupported, MediaType expectedMediaType, String... acceptMediaTypes) {
protected void assertMediaTypes(WebResource resource, boolean postSupported, String expectedMediaType, String... acceptMediaTypes) {
// test GET request
ClientResponse response = resource.accept(acceptMediaTypes).get(ClientResponse.class);
assertMediaType(response, expectedMediaType);
Expand All @@ -326,7 +326,7 @@ protected void assertMediaTypes(WebResource resource, boolean postSupported, Med
}
}

protected void assertMediaType(ClientResponse response, MediaType expected) {
protected void assertMediaType(ClientResponse response, String expected) {
MediaType actual = response.getType();
assertEquals(200, response.getStatus());
// use startsWith cause sometimes server also returns quality parameters (e.g. websphere/wink)
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<configuration>
<rules>
<requireJavaVersion>
<version>[1.8,)</version>
<version>[17,)</version>
</requireJavaVersion>
</rules>
</configuration>
Expand Down
1 change: 1 addition & 0 deletions spring-boot-starter/starter-client/spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
<version>${version.mockito}</version>
</dependency>

</dependencies>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.camunda.bpm.client.spring.boot.starter.impl.ClientAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.util.Map;

@RunWith(SpringRunner.class)
Expand Down
1 change: 1 addition & 0 deletions spring-boot-starter/starter-client/spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
<version>${version.mockito}</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@
<artifactId>qa-request-scope</artifactId>
<name>Camunda Platform - Spring Boot Starter - QA - Request Scope</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-core-internal-dependencies</artifactId>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<dependency>
Expand Down Expand Up @@ -53,12 +41,15 @@
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>${version.graal.js}</version>
</dependency>

<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>${version.graal.js}</version>
</dependency>

</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<dependency>
<groupId>org.camunda.bpm.example</groupId>
<artifactId>camunda-example-invoice</artifactId>
<artifactId>camunda-example-invoice-jakarta</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
<scope>compile</scope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.event.EventListener;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

@SpringBootApplication
@EnableProcessApplication("myProcessApplication")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
<properties>
<version.jersey-json>1.15</version.jersey-json>
<version.h2>1.4.199</version.h2>
<version.glassfish-jaxb>2.3.1</version.glassfish-jaxb>
<version.jaxb-api>2.3.1</version.jaxb-api>
<version.jersey-apache-client>1.15</version.jersey-apache-client>
<version.junit>4.12</version.junit>
<version.chromedriver>112.0.5615.49</version.chromedriver>
<version.selenium>4.10.0</version.selenium>


<http.port>58080</http.port>
<http.ctx-path.webapp>camunda/</http.ctx-path.webapp>
Expand All @@ -30,6 +32,7 @@
<id>integration-test-spring-boot-starter</id>

<dependencies>

<!-- Web Applications -->
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
Expand Down Expand Up @@ -79,6 +82,13 @@
<version>${version.jersey-apache-client}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${version.httpclient}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
Expand Down Expand Up @@ -127,6 +137,13 @@
<version>${version.graal.js}</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${version.jaxb-api}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
9 changes: 1 addition & 8 deletions spring-boot-starter/starter-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-rest-core</artifactId>
<artifactId>camunda-engine-rest-core-jakarta</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down Expand Up @@ -54,13 +54,6 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${version.xml.jaxb-impl}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.springframework.boot.autoconfigure.web.servlet.JerseyApplicationPath;
import org.springframework.boot.web.servlet.ServletContextInitializer;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import java.util.EnumSet;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.camunda.bpm.spring.boot.starter.rest;

import javax.ws.rs.ApplicationPath;
import jakarta.ws.rs.ApplicationPath;
import org.camunda.bpm.engine.rest.impl.CamundaRestResources;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.server.ResourceConfig;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.camunda.bpm.spring.boot.starter.rest.CamundaBpmRestJerseyAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package my.own.custom.spring.boot.project;

import javax.ws.rs.ApplicationPath;
import jakarta.ws.rs.ApplicationPath;

import org.camunda.bpm.spring.boot.starter.rest.CamundaJerseyResourceConfig;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package my.own.custom.spring.boot.project;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;

import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceDto;
Expand Down
3 changes: 2 additions & 1 deletion spring-boot-starter/starter-webapp-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<dependency>
<groupId>org.camunda.bpm.webapp</groupId>
<artifactId>camunda-webapp</artifactId>
<artifactId>camunda-webapp-jakarta</artifactId>
<type>jar</type>
<classifier>classes</classifier>
</dependency>
Expand Down Expand Up @@ -63,6 +63,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
<version>${version.mockito}</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import java.util.EnumSet;
import java.util.Map;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionTrackingMode;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletRegistration;
import jakarta.servlet.SessionTrackingMode;

import org.camunda.bpm.admin.impl.web.AdminApplication;
import org.camunda.bpm.admin.impl.web.bootstrap.AdminContainerBootstrap;
Expand Down
Loading

0 comments on commit 6b2e2f2

Please sign in to comment.