Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring boot upgrade 3.3 #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: maven:3.3.9-jdk-8
image: maven:3.9-eclipse-temurin-21-alpine

variables:
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
Expand Down
61 changes: 54 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

<groupId>uk.ac.ebi.pride.archive</groupId>
<artifactId>pride-mongodb-repo</artifactId>
<version>1.0.9-SNAPSHOT</version>
<version>1.0.10-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PRIDE MongoDB repository</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<version>3.3.3</version>
</parent>

<!-- This project requires several maven profiles to build and run correctly.
Expand All @@ -24,6 +24,7 @@

<properties>
<archive.data.provider.api.version>1.0.1-SNAPSHOT</archive.data.provider.api.version>
<maven.compiler.release>17</maven.compiler.release>
<uk.ac.ebi.pride.architectural-pride-tdd.version>1.0.4-SNAPSHOT</uk.ac.ebi.pride.architectural-pride-tdd.version>
<uk.ac.ebi.pride.architectural-pride-spring.version>1.0.0-SNAPSHOT</uk.ac.ebi.pride.architectural-pride-spring.version>
<uk.ac.ebi.pride.px-submission-core.version>2.0.18</uk.ac.ebi.pride.px-submission-core.version>
Expand All @@ -41,17 +42,14 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>


Expand All @@ -76,6 +74,21 @@
<version>${uk.ac.ebi.pride.architectural-pride-tdd.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>


<!-- EmbedMongo for in-memory MongoDB instances as Fongo deprecated-->
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>3.5.4</version>
<scope>test</scope>
</dependency>

<!-- MongoDB and Lombok -->
Expand All @@ -84,6 +97,13 @@
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>

<!-- MongoDB Java Driver -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.9.1</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
Expand Down Expand Up @@ -122,7 +142,6 @@
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -141,7 +160,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -238,6 +256,35 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.39.0</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.17.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<parameters>true</parameters>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package uk.ac.ebi.pride.mongodb.archive.model.projects;

import lombok.*;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.experimental.SuperBuilder;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
Expand Down Expand Up @@ -46,6 +49,7 @@ public MongoPrideProject() {
* Project Accession in PRIDE
**/
@Indexed(unique = true, name = PrideArchiveField.ACCESSION)
@Field(value = PrideArchiveField.ACCESSION)
protected String accession;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.ac.ebi.pride.mongodb.archive.model.projects;

import lombok.*;
import lombok.Builder;
import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.repository.support.PageableExecutionUtils;
import org.springframework.data.support.PageableExecutionUtils;
import uk.ac.ebi.pride.archive.dataprovider.common.Triple;
import uk.ac.ebi.pride.mongodb.archive.model.PrideArchiveField;
import uk.ac.ebi.pride.mongodb.archive.model.files.MongoPrideFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.repository.support.PageableExecutionUtils;
import org.springframework.data.support.PageableExecutionUtils;
import uk.ac.ebi.pride.archive.dataprovider.common.Triple;
import uk.ac.ebi.pride.mongodb.archive.model.PrideArchiveField;
import uk.ac.ebi.pride.mongodb.archive.model.msrun.MongoPrideMSRun;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package uk.ac.ebi.pride.mongodb.archive.repo.projects;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.repository.support.PageableExecutionUtils;
import org.springframework.data.support.PageableExecutionUtils;
import uk.ac.ebi.pride.mongodb.archive.model.PrideArchiveField;
import uk.ac.ebi.pride.mongodb.archive.model.projects.MongoImportedProject;

Expand All @@ -21,7 +20,6 @@ public class ImportedProjectMongoRepositoryCustomImpl implements ImportedProject

private final MongoTemplate mongoTemplate;

@Autowired
public ImportedProjectMongoRepositoryCustomImpl(@Qualifier("archiveMongoTemplate") MongoTemplate mongoTemplate) {
this.mongoTemplate = mongoTemplate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.repository.support.PageableExecutionUtils;
import org.springframework.data.support.PageableExecutionUtils;
import uk.ac.ebi.pride.archive.dataprovider.common.Triple;
import uk.ac.ebi.pride.mongodb.archive.model.projects.MongoPrideAnalysis;
import uk.ac.ebi.pride.mongodb.utils.PrideMongoUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import uk.ac.ebi.pride.mongodb.archive.model.PrideArchiveField;
import uk.ac.ebi.pride.mongodb.archive.model.projects.MongoPrideProject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package uk.ac.ebi.pride.mongodb.archive.repo.projects;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.repository.support.PageableExecutionUtils;
import org.springframework.data.support.PageableExecutionUtils;
import uk.ac.ebi.pride.mongodb.archive.model.PrideArchiveField;
import uk.ac.ebi.pride.mongodb.archive.model.projects.MongoPrideProject;

Expand All @@ -21,7 +20,6 @@ public class PrideProjectMongoRepositoryCustomImpl implements PrideProjectMongoR

private final MongoTemplate mongoTemplate;

@Autowired
public PrideProjectMongoRepositoryCustomImpl(@Qualifier("archiveMongoTemplate") MongoTemplate mongoTemplate) {
this.mongoTemplate = mongoTemplate;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package uk.ac.ebi.pride.mongodb.archive.service.assays;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.stereotype.Service;
import uk.ac.ebi.pride.archive.dataprovider.common.Triple;
Expand Down Expand Up @@ -30,7 +29,6 @@ public class PrideAssayMongoService {

final PrideAssayMongoRepository assayRepository;

@Autowired
public PrideAssayMongoService(PrideAssayMongoRepository assayRepository) {
this.assayRepository = assayRepository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void setMongoOperations(MongoTemplate mongoTemplate) {
this.mongoOperations = mongoTemplate;
}

@Autowired
public PrideFileMongoService(PrideFileMongoRepository fileRepository, PrideMSRunMongoRepository msRunMongoRepository) {
this.fileRepository = fileRepository;
this.msRunMongoRepository = msRunMongoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class PrideMsRunMongoService implements IMSRunService {
OntologyCacheService ontologyCacheService;


@Autowired
public PrideMsRunMongoService(PrideMSRunMongoRepository msRunRepository) {
this.msRunRepository = msRunRepository;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand All @@ -28,7 +27,6 @@ public class ImportedProjectMongoService {
final ImportedProjectMongoRepository repository;
final PrideAssayMongoRepository assayMongoRepository;

@Autowired
public ImportedProjectMongoService(ImportedProjectMongoRepository repository, PrideAssayMongoRepository assayMongoRepository) {
this.repository = repository;
this.assayMongoRepository = assayMongoRepository;
Expand All @@ -41,7 +39,7 @@ public ImportedProjectMongoService(ImportedProjectMongoRepository repository, Pr
* @return MongoImportedProject
*/
public Optional<MongoImportedProject> insert(MongoImportedProject project) {
if (!repository.findByAccession(project.getAccession()).isPresent()) {
if (repository.findByAccession(project.getAccession()).isEmpty()) {
project = repository.save(project);
log.info("A new project has been saved into MongoDB database with Accession -- " + project.getAccession());
} else
Expand Down Expand Up @@ -196,7 +194,7 @@ public boolean deleteByAccession(String accession) {
public void saveAssays(List<MongoPrideAssay> mongoAssays) {
mongoAssays.forEach(x -> {
Optional<MongoPrideAssay> currentAssay = assayMongoRepository.findPrideAssayByAccession(x.getAccession());
if (!currentAssay.isPresent())
if (currentAssay.isEmpty())
assayMongoRepository.save(x);
else {
updateAssay(currentAssay.get(), x);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package uk.ac.ebi.pride.mongodb.archive.service.projects;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.pride.mongodb.archive.repo.projects.PrideAnalysisMongoRepository;

Expand All @@ -18,7 +17,6 @@ public class PrideAnalysisMongoService {
// @Autowired
// private MongoOperations mongo;

@Autowired
public PrideAnalysisMongoService(PrideAnalysisMongoRepository repository) {
this.repository = repository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -33,7 +32,6 @@ public class PrideProjectMongoService {
final PrideProjectMongoRepository repository;
final PrideAssayMongoRepository assayMongoRepository;

@Autowired
public PrideProjectMongoService(PrideProjectMongoRepository repository, PrideAssayMongoRepository assayMongoRepository) {
this.repository = repository;
this.assayMongoRepository = assayMongoRepository;
Expand All @@ -46,7 +44,7 @@ public PrideProjectMongoService(PrideProjectMongoRepository repository, PrideAss
* @return MongoPrideProject
*/
public Optional<MongoPrideProject> insert(MongoPrideProject project) {
if (!repository.findByAccession(project.getAccession()).isPresent()) {
if (repository.findByAccession(project.getAccession()).isEmpty()) {
project = repository.save(project);
log.info("A new project has been saved into MongoDB database with Accession -- " + project.getAccession());
} else
Expand Down Expand Up @@ -201,7 +199,7 @@ public boolean deleteByAccession(String accession) {
public void saveAssays(List<MongoPrideAssay> mongoAssays) {
mongoAssays.forEach(x -> {
Optional<MongoPrideAssay> currentAssay = assayMongoRepository.findPrideAssayByAccession(x.getAccession());
if (!currentAssay.isPresent())
if (currentAssay.isEmpty())
assayMongoRepository.save(x);
else {
updateAssay(currentAssay.get(), x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.extern.slf4j.Slf4j;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.pride.mongodb.archive.model.projects.MongoPrideReanalysisProject;
import uk.ac.ebi.pride.mongodb.archive.repo.projects.PrideReanalysisMongoRepository;
Expand All @@ -25,7 +24,6 @@ public class PrideReanalysisMongoService {

final PrideReanalysisMongoRepository repository;

@Autowired
public PrideReanalysisMongoService(PrideReanalysisMongoRepository repository) {
this.repository = repository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.pride.archive.dataprovider.sample.ISampleMSRunRow;
import uk.ac.ebi.pride.archive.dataprovider.sample.SampleProvider;
Expand Down Expand Up @@ -37,7 +36,6 @@ public class PrideSampleMongoService {
/** Logger use to query and filter the data **/
private static final Logger LOGGER = LoggerFactory.getLogger(PrideSampleMongoService.class);

@Autowired
public PrideSampleMongoService(PrideMongoExperimentalDesign prideMongoExperimentalDesign) {
this.prideMongoExperimentalDesign = prideMongoExperimentalDesign;
}
Expand Down
Loading