From ccba88de94ab4240e48c8b1cdb7cf5fede25b406 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Wed, 8 Nov 2023 14:21:50 +0000 Subject: [PATCH] #876 - upgrade to Java 21 --- ...r2dbc-sample.yml => r2dbc-boot-sample.yml} | 6 ++--- r2dbc/boot-r2dbc-sample/pom.xml | 24 +++++++++++++++++-- .../services/ReactivePostService.java | 9 +++---- 3 files changed, 30 insertions(+), 9 deletions(-) rename .github/workflows/{boot-r2dbc-sample.yml => r2dbc-boot-sample.yml} (88%) diff --git a/.github/workflows/boot-r2dbc-sample.yml b/.github/workflows/r2dbc-boot-sample.yml similarity index 88% rename from .github/workflows/boot-r2dbc-sample.yml rename to .github/workflows/r2dbc-boot-sample.yml index d66f88872..858f68592 100644 --- a/.github/workflows/boot-r2dbc-sample.yml +++ b/.github/workflows/r2dbc-boot-sample.yml @@ -25,11 +25,11 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3.13.0 with: - java-version: 17 - distribution: "zulu" + java-version: 21 + distribution: "microsoft" cache: "maven" - name: Build and analyze run: ./mvnw clean verify diff --git a/r2dbc/boot-r2dbc-sample/pom.xml b/r2dbc/boot-r2dbc-sample/pom.xml index e74a5754e..32828a3df 100644 --- a/r2dbc/boot-r2dbc-sample/pom.xml +++ b/r2dbc/boot-r2dbc-sample/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.5 + 3.2.0-RC2 com.example.bootr2dbc @@ -20,7 +20,7 @@ UTF-8 UTF-8 - 17 + 21 2.2.0 1.5.5.Final @@ -420,4 +420,24 @@ + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/r2dbc/boot-r2dbc-sample/src/main/java/com/example/bootr2dbc/services/ReactivePostService.java b/r2dbc/boot-r2dbc-sample/src/main/java/com/example/bootr2dbc/services/ReactivePostService.java index 7d015bb01..313b28abd 100644 --- a/r2dbc/boot-r2dbc-sample/src/main/java/com/example/bootr2dbc/services/ReactivePostService.java +++ b/r2dbc/boot-r2dbc-sample/src/main/java/com/example/bootr2dbc/services/ReactivePostService.java @@ -15,7 +15,7 @@ import reactor.core.publisher.Mono; @Service -@Transactional +@Transactional(readOnly = true) @RequiredArgsConstructor public class ReactivePostService { @@ -23,7 +23,6 @@ public class ReactivePostService { private final ReactiveCommentsRepository reactiveCommentsRepository; private final ReactivePostMapper reactivePostMapper; - @Transactional(readOnly = true) public Flux findAllReactivePosts(String sortBy, String sortDir) { Sort sort = sortDir.equalsIgnoreCase(Sort.Direction.ASC.name()) @@ -33,21 +32,21 @@ public Flux findAllReactivePosts(String sortBy, String sortDir) { return reactivePostRepository.findAll(sort); } - @Transactional(readOnly = true) public Mono findReactivePostById(Long id) { return reactivePostRepository.findById(id); } - @Transactional(readOnly = true) public Flux findCommentsForReactivePost(Long id) { return reactiveCommentsRepository.findAllByPostId(id); } + @Transactional public Mono saveReactivePost(ReactivePostRequest reactivePostRequest) { ReactivePost reactivePost = reactivePostMapper.mapToReactivePost(reactivePostRequest); return reactivePostRepository.save(reactivePost); } + @Transactional public Mono updateReactivePost( ReactivePostRequest reactivePostRequest, ReactivePost reactivePost) { this.reactivePostMapper.updateReactivePostFromReactivePostRequest( @@ -55,10 +54,12 @@ public Mono updateReactivePost( return reactivePostRepository.save(reactivePost); } + @Transactional public Mono deleteReactivePostById(Long id) { return reactivePostRepository.deleteById(id); } + @Transactional public Mono> deleteReactivePostAndCommentsById(Long id) { return findReactivePostById(id) .flatMap(