Skip to content

Commit

Permalink
Merge pull request Onlineberatung#211 from Onlineberatung/TSYSTEMS-19…
Browse files Browse the repository at this point in the history
…6-upgrade-spring-boot-to-3.1.X

feat: upgrade spring boot to 3.1
  • Loading branch information
tkuzynow authored Dec 6, 2024
2 parents e9fdc68 + 19d6de8 commit 608df55
Show file tree
Hide file tree
Showing 80 changed files with 543 additions and 664 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/admin-api-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup JVM
uses: actions/setup-java@v1
with:
java-version: 11.0.10
java-version: 17
java-package: jdk
architecture: x64

Expand Down
65 changes: 25 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.6</version>
<version>3.3.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -89,17 +89,14 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring-security.version}</version>
</dependency>
<!-- Spring actuator -->
<dependency>
Expand All @@ -124,17 +121,6 @@
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>
<!-- SpringFox: generate YAML file from POJOs and generate documentation -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.15</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox.boot.starter.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
Expand Down Expand Up @@ -171,9 +157,8 @@
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax.ws.rs-api.version}</version>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>

<!-- Lombok dependencies -->
Expand All @@ -183,11 +168,11 @@
<optional>true</optional>
</dependency>


<!-- Apache Commons Lang -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>

<dependency>
Expand All @@ -212,7 +197,6 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase-core.version}</version>
</dependency>


Expand Down Expand Up @@ -242,17 +226,14 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j.version}</version>
</dependency>


Expand All @@ -266,12 +247,6 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.15</version>
</dependency>


Expand All @@ -282,7 +257,6 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -294,12 +268,6 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- required only for WebMvc "fluent" API -->
<groupId>com.c4-soft.springaddons</groupId>
Expand All @@ -318,6 +286,7 @@
</resource>
</resources>
<plugins>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down Expand Up @@ -554,7 +523,6 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase-maven-plugin.version}</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
Expand All @@ -563,7 +531,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.0</version>
<version>3.6.0</version>
<executions>
<execution>
<id>validate</id>
Expand All @@ -587,9 +555,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
<compilerArgs>--enable-preview</compilerArgs>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -629,6 +596,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.46.1</version>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_3</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-spring</artifactId>
<version>5.24.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import de.caritas.cob.agencyservice.api.model.Sort;
import de.caritas.cob.agencyservice.api.model.UpdateAgencyDTO;
import de.caritas.cob.agencyservice.generated.api.admin.controller.AgencyadminApi;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;

Expand All @@ -33,7 +33,7 @@
* Controller to handle all agency admin requests.
*/
@RestController
@Api(tags = "admin-agency-controller")
@Tag(name = "admin-agency-controller")
@RequiredArgsConstructor
public class AgencyAdminController implements AgencyadminApi {

Expand Down Expand Up @@ -92,8 +92,6 @@ public ResponseEntity<AgencyAdminSearchResultDTO> searchAgencies(
@Override
@PreAuthorize("hasAuthority('AUTHORIZATION_AGENCY_ADMIN')")
public ResponseEntity<AgencyAdminFullResponseDTO> createAgency(@Valid AgencyDTO agencyDTO) {


agencyValidator.validate(agencyDTO);
var agencyAdminFullResponseDTO = agencyAdminService
.createAgency(agencyDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import de.caritas.cob.agencyservice.api.model.FullAgencyResponseDTO;
import de.caritas.cob.agencyservice.api.service.AgencyService;
import de.caritas.cob.agencyservice.generated.api.controller.AgenciesApi;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import java.util.Optional;
import lombok.NonNull;
Expand All @@ -22,7 +22,7 @@
* Controller for agency API requests
*/
@RestController
@Api(tags = "agency-controller")
@Tag(name = "agency-controller")
@RequiredArgsConstructor
public class AgencyController implements AgenciesApi {

Expand All @@ -40,10 +40,10 @@ public class AgencyController implements AgenciesApi {
@Override
public ResponseEntity<List<FullAgencyResponseDTO>> getAgencies(
@RequestParam Integer consultingType, @RequestParam(required = false) String postcode,
@RequestParam(value = "topicId", required = false) Integer topicId,
@RequestParam(value = "age", required = false) Integer age,
@RequestParam(value = "gender", required = false) String gender,
@RequestParam(value = "counsellingRelation", required = false) String counsellingRelation
@RequestParam(required = false) Integer topicId,
@RequestParam(required = false) Integer age,
@RequestParam(required = false) String gender,
@RequestParam(required = false) String counsellingRelation
) {

var agencies = agencyService.getAgencies(Optional.ofNullable(postcode), consultingType,
Expand All @@ -62,7 +62,7 @@ public ResponseEntity<List<FullAgencyResponseDTO>> getAgencies(
*/
@Override
public ResponseEntity<List<AgencyResponseDTO>> getAgenciesByIds(
@PathVariable("agencyIds") List<Long> agencyIds) {
@PathVariable List<Long> agencyIds) {

var agencies = agencyService.getAgencies(agencyIds);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package de.caritas.cob.agencyservice.api.exception;

import java.io.Serial;

public class KeycloakException extends RuntimeException {

@Serial
private static final long serialVersionUID = -5083156826149548581L;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package de.caritas.cob.agencyservice.api.exception;

import java.io.Serial;

public class MissingConsultingTypeException extends Exception {

@Serial
private static final long serialVersionUID = -6127271234647444277L;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package de.caritas.cob.agencyservice.api.exception.httpresponses;

import de.caritas.cob.agencyservice.api.service.LogService;
import java.io.Serial;

public class BadRequestException extends CustomHttpStatusException {

@Serial
private static final long serialVersionUID = -8047408802295905803L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import static java.util.Objects.nonNull;

import java.io.Serial;
import java.util.function.Consumer;

/**
* Custom HTTP status exception.
*/
public abstract class CustomHttpStatusException extends RuntimeException {

@Serial
private static final long serialVersionUID = -3545035432045919306L;
private final Consumer<Exception> loggingMethod;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package de.caritas.cob.agencyservice.api.exception.httpresponses;

import de.caritas.cob.agencyservice.api.service.LogService;
import java.io.Serial;
import java.util.function.Consumer;

/**
* Represents the exception for an internal server error - status code 500.
*/
public class InternalServerErrorException extends CustomHttpStatusException {

@Serial
private static final long serialVersionUID = 6051508644381775936L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ExtendedConsultingTypeResponseDTO getConsultingTypeSettings(int consultin
return consultingTypeService.getExtendedConsultingTypeResponseDTO(consultingTypeId);
} catch (RestClientException ex) {
throw new MissingConsultingTypeException(
String.format("No settings for consulting type %s found.", consultingTypeId));
"No settings for consulting type %s found.".formatted(consultingTypeId));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
@Getter
@Setter
@Builder
@FilterDef(
name = "tenantFilter",
parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class Agency implements TenantAware {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
@Getter
@Setter
@Builder
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class AgencyPostcodeRange implements TenantAware {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@FilterDefs({
@FilterDef(
name = "tenantFilter",
parameters = {@ParamDef(name = "tenantId", type = Long.class)}
)
})
package de.caritas.cob.agencyservice.api.repository;

import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.FilterDefs;
import org.hibernate.annotations.ParamDef;
Loading

0 comments on commit 608df55

Please sign in to comment.