Skip to content

Commit

Permalink
#876 - upgrade to Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 8, 2023
1 parent 0d0187b commit ccba88d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
java-version: 17
distribution: "zulu"
java-version: 21
distribution: "microsoft"
cache: "maven"
- name: Build and analyze
run: ./mvnw clean verify
24 changes: 22 additions & 2 deletions r2dbc/boot-r2dbc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>3.2.0-RC2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.bootr2dbc</groupId>
Expand All @@ -20,7 +20,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>17</java.version>
<java.version>21</java.version>
<springdoc-openapi.version>2.2.0</springdoc-openapi.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>

Expand Down Expand Up @@ -420,4 +420,24 @@
</plugins>
</build>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
import reactor.core.publisher.Mono;

@Service
@Transactional
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class ReactivePostService {

private final ReactivePostRepository reactivePostRepository;
private final ReactiveCommentsRepository reactiveCommentsRepository;
private final ReactivePostMapper reactivePostMapper;

@Transactional(readOnly = true)
public Flux<ReactivePost> findAllReactivePosts(String sortBy, String sortDir) {
Sort sort =
sortDir.equalsIgnoreCase(Sort.Direction.ASC.name())
Expand All @@ -33,32 +32,34 @@ public Flux<ReactivePost> findAllReactivePosts(String sortBy, String sortDir) {
return reactivePostRepository.findAll(sort);
}

@Transactional(readOnly = true)
public Mono<ReactivePost> findReactivePostById(Long id) {
return reactivePostRepository.findById(id);
}

@Transactional(readOnly = true)
public Flux<ReactiveComments> findCommentsForReactivePost(Long id) {
return reactiveCommentsRepository.findAllByPostId(id);
}

@Transactional
public Mono<ReactivePost> saveReactivePost(ReactivePostRequest reactivePostRequest) {
ReactivePost reactivePost = reactivePostMapper.mapToReactivePost(reactivePostRequest);
return reactivePostRepository.save(reactivePost);
}

@Transactional
public Mono<ReactivePost> updateReactivePost(
ReactivePostRequest reactivePostRequest, ReactivePost reactivePost) {
this.reactivePostMapper.updateReactivePostFromReactivePostRequest(
reactivePostRequest, reactivePost);
return reactivePostRepository.save(reactivePost);
}

@Transactional
public Mono<Void> deleteReactivePostById(Long id) {
return reactivePostRepository.deleteById(id);
}

@Transactional
public Mono<ResponseEntity<Object>> deleteReactivePostAndCommentsById(Long id) {
return findReactivePostById(id)
.flatMap(
Expand Down

0 comments on commit ccba88d

Please sign in to comment.