Skip to content

Commit

Permalink
Closes #2486 : Upgrade to Spring Boot 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arolfes authored and gitgoodjhe committed Aug 7, 2024
1 parent 611a735 commit a3e4552
Show file tree
Hide file tree
Showing 35 changed files with 107 additions and 272 deletions.
83 changes: 0 additions & 83 deletions history/taskana-simplehistory-rest-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>capital.scalable</groupId>
<artifactId>spring-auto-restdocs-core</artifactId>
<version>${version.auto-restdocs}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand All @@ -147,28 +141,6 @@

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.maven.resources}</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/generated-javadoc-json</outputDirectory>
<resources>
<resource>
<directory>../../rest/taskana-rest-spring/target/generated-javadoc-json
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -182,61 +154,6 @@
</tag>
</tags>
</configuration>
<executions>
<execution>
<id>generate-javadoc-json</id>
<phase>validate</phase>
<goals>
<goal>javadoc-no-fork</goal>
</goals>
<configuration>
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
<docletArtifact>
<groupId>capital.scalable</groupId>
<artifactId>spring-auto-restdocs-json-doclet-jdk9</artifactId>
<version>${version.auto-restdocs}</version>
</docletArtifact>
<destDir>generated-javadoc-json</destDir>
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
<useStandardDocletOptions>false</useStandardDocletOptions>
<show>package</show>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${version.maven.asciidoctor}</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
<configuration>
<backend>html5</backend>
<doctype>book</doctype>
<attributes>
<snippets>${project.build.directory}/generated-snippets</snippets>
<doctype>book</doctype>
<icons>font</icons>
<source-highlighter>highlightjs</source-highlighter>
<toc>left</toc>
<docinfo>shared</docinfo>
<toclevels>4</toclevels>
<sectlinks/>
</attributes>
<logHandler>
<outputToConsole>false</outputToConsole>
<failIf>
<severity>ERROR</severity>
</failIf>
</logHandler>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public ResponseEntity<TaskHistoryEventPagedRepresentationModel> getTaskHistoryEv
@GetMapping(path = HistoryRestEndpoints.URL_HISTORY_EVENTS_ID)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskHistoryEventRepresentationModel> getTaskHistoryEvent(
@PathVariable String historyEventId) throws TaskanaHistoryEventNotFoundException {
@PathVariable("historyEventId") String historyEventId)
throws TaskanaHistoryEventNotFoundException {
TaskHistoryEvent resultEvent = simpleHistoryService.getTaskHistoryEvent(historyEventId);

TaskHistoryEventRepresentationModel taskEventResource = assembler.toModel(resultEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.rest.test.BaseRestDocTest;

@Disabled
class TaskHistoryEventControllerRestDocTest extends BaseRestDocTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void cleanTaskanaH2DataFolder() throws IOException {
// Delete Taskana folder if exists
Path taskanaH2Data = Path.of(System.getProperty("user.home"), "taskana-h2-data");
if (Files.exists(taskanaH2Data)) {
FileUtils.deleteDirectory(taskanaH2Data.toFile());
FileUtils.forceDelete(taskanaH2Data.toFile());
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/taskana-cdi-example/src/test/resources/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<module name="com.h2database.h2" xmlns="urn:jboss:module:1.9">

<resources>
<resource-root path="h2-2.1.214.jar"/>
<resource-root path="h2-2.2.224.jar"/>
</resources>
<dependencies>
<module name="java.compiler"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void beforeClass() throws IOException {
// Delete Taskana folder if exists
Path taskanaH2Data = Path.of(System.getProperty("user.home"), "taskana-h2-data");
if (Files.exists(taskanaH2Data)) {
FileUtils.deleteDirectory(taskanaH2Data.toFile());
FileUtils.forceDelete(taskanaH2Data.toFile());
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/taskana-cdi/src/test/resources/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<module name="com.h2database.h2" xmlns="urn:jboss:module:1.9">

<resources>
<resource-root path="h2-2.1.214.jar"/>
<resource-root path="h2-2.2.224.jar"/>
</resources>
<dependencies>
<module name="java.compiler"/>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<!-- spring dependencies -->
<version.jakarta.annotation-api>2.1.1</version.jakarta.annotation-api>
<version.spring.plugin.core>3.0.0</version.spring.plugin.core>
<version.spring.boot>3.1.5</version.spring.boot>
<version.spring.boot>3.2.4</version.spring.boot>
<version.spring.mybatis>3.0.2</version.spring.mybatis>

<!-- wildfly dependencies -->
Expand Down
2 changes: 2 additions & 0 deletions rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<module>../web</module>
<module>taskana-rest-spring-example-common</module>
<module>taskana-rest-spring-example-boot</module>
<!-- enable it, when decission is made how to proceed
<module>taskana-rest-spring-example-wildfly</module>
-->
<module>taskana-rest-spring-test-lib</module>
</modules>

Expand Down
1 change: 1 addition & 0 deletions rest/taskana-rest-spring-example-wildfly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<artifactId>taskana-rest-spring-example-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<module name="org.postgresql.postgresql" xmlns="urn:jboss:module:1.9">

<resources>
<resource-root path="postgresql-42.6.0.jar"/>
<resource-root path="postgresql-42.6.2.jar"/>
</resources>

<!-- don't know why it is still javax, but this is the only way how the postgresql module is loaded -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import java.util.function.Function;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
Expand Down Expand Up @@ -65,17 +65,16 @@ public WebMvcConfigurer corsConfigurer() {
}

@Bean
public FilterRegistrationBean<CorsFilter> corsFilter() {
@Order(0)
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
bean.setOrder(0);
return bean;
return new CorsFilter(source);
}

@Bean
Expand Down
70 changes: 0 additions & 70 deletions rest/taskana-rest-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
Expand All @@ -154,12 +149,6 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>capital.scalable</groupId>
<artifactId>spring-auto-restdocs-core</artifactId>
<version>${version.auto-restdocs}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand Down Expand Up @@ -194,65 +183,6 @@
</tag>
</tags>
</configuration>
<executions>
<execution>
<id>generate-javadoc-json</id>
<phase>validate</phase>
<goals>
<goal>javadoc-no-fork</goal>
</goals>
<configuration>
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
<docletArtifact>
<groupId>capital.scalable</groupId>
<!--
currently the jdk9+ version of this doclet has a very bad bug.
see: https://github.com/ScaCap/spring-auto-restdocs/issues/412
-->
<artifactId>spring-auto-restdocs-json-doclet-jdk9</artifactId>
<version>${version.auto-restdocs}</version>
</docletArtifact>
<destDir>generated-javadoc-json</destDir>
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
<useStandardDocletOptions>false</useStandardDocletOptions>
<show>package</show>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${version.maven.asciidoctor}</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
<configuration>
<backend>html5</backend>
<doctype>book</doctype>
<attributes>
<snippets>${project.build.directory}/generated-snippets</snippets>
<doctype>book</doctype>
<icons>font</icons>
<source-highlighter>highlightjs</source-highlighter>
<toc>left</toc>
<docinfo>shared</docinfo>
<toclevels>4</toclevels>
<sectlinks/>
</attributes>
<logHandler>
<outputToConsole>false</outputToConsole>
<failIf>
<severity>ERROR</severity>
</failIf>
</logHandler>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public ResponseEntity<ClassificationSummaryPagedRepresentationModel> getClassifi
@GetMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> getClassification(
@PathVariable String classificationId) throws ClassificationNotFoundException {
@PathVariable("classificationId") String classificationId)
throws ClassificationNotFoundException {
Classification classification = classificationService.getClassification(classificationId);
return ResponseEntity.ok(modelAssembler.toModel(classification));
}
Expand Down Expand Up @@ -159,7 +160,7 @@ public ResponseEntity<ClassificationRepresentationModel> createClassification(
@PutMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> updateClassification(
@PathVariable(value = "classificationId") String classificationId,
@PathVariable("classificationId") String classificationId,
@RequestBody ClassificationRepresentationModel resource)
throws ClassificationNotFoundException,
ConcurrencyException,
Expand Down Expand Up @@ -193,7 +194,7 @@ public ResponseEntity<ClassificationRepresentationModel> updateClassification(
@DeleteMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> deleteClassification(
@PathVariable String classificationId)
@PathVariable("classificationId") String classificationId)
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
classificationService.deleteClassification(classificationId);
return ResponseEntity.noContent().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class ClassificationDefinitionController {
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_DEFINITIONS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationDefinitionCollectionRepresentationModel>
exportClassifications(@RequestParam(required = false) String[] domain) {
exportClassifications(@RequestParam(value = "domain", required = false) String[] domain) {
ClassificationQuery query = classificationService.createClassificationQuery();

List<ClassificationSummary> summaries =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ResponseEntity<List<String>> getDomains() {
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<List<String>> getClassificationCategories(
@RequestParam(required = false) String type) {
@RequestParam(value = "type", required = false) String type) {
if (type != null) {
return ResponseEntity.ok(taskanaConfiguration.getClassificationCategoriesByType(type));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,22 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
Map.entry(UnsupportedDatabaseException.ERROR_KEY, HttpStatus.INTERNAL_SERVER_ERROR),
Map.entry(ERROR_KEY_UNKNOWN_ERROR, HttpStatus.INTERNAL_SERVER_ERROR));

@ExceptionHandler(MaxUploadSizeExceededException.class)
@Override
protected ResponseEntity<Object> handleMaxUploadSizeExceededException(
MaxUploadSizeExceededException ex, WebRequest req) {
HttpStatus status =
MaxUploadSizeExceededException ex,
HttpHeaders headers,
HttpStatusCode status,
WebRequest request
) {

return buildResponse(
ErrorCode.of(ERROR_KEY_PAYLOAD),
ex,
request,
HTTP_STATUS_BY_ERROR_CODE_KEY.getOrDefault(
ERROR_KEY_PAYLOAD, HttpStatus.INTERNAL_SERVER_ERROR);
return buildResponse(ErrorCode.of(ERROR_KEY_PAYLOAD), ex, req, status);
ERROR_KEY_PAYLOAD, HttpStatus.INTERNAL_SERVER_ERROR
)
);
}

@ExceptionHandler(BeanInstantiationException.class)
Expand Down
Loading

0 comments on commit a3e4552

Please sign in to comment.