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

Upgrade to Spring Boot 2.6 #37

Merged
merged 2 commits into from
Mar 19, 2022
Merged
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
50 changes: 32 additions & 18 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId>
<version>2.0.0</version>
<version>2.6.2</version>
<packaging>war</packaging>

<name>petclinic</name>
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -24,18 +24,15 @@
<java.version>1.8</java.version>

<spring-data-jdbc.version>1.2.1.RELEASE</spring-data-jdbc.version>
<cobertura.version>2.7</cobertura.version>

</properties>
<jaxb-api.version>2.3.1</jaxb-api.version>
<jaxb-runtime.version>2.3.4</jaxb-runtime.version>

<!-- repository for springfox plugin -->
<repositories>
<repository>
<id>jcenter-snapshots</id>
<name>jcenter</name>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<cobertura.version>2.7</cobertura.version>
<graphql-java-tools.version>4.3.0</graphql-java-tools.version>
<graphiql-spring-boot-starter.version>4.0.0</graphiql-spring-boot-starter.version>
<graphql-spring-boot-starter.version>4.0.0</graphql-spring-boot-starter.version>
<hamcrest-all.version>1.3</hamcrest-all.version>
</properties>

<dependencies>
<dependency>
Expand All @@ -54,6 +51,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand All @@ -65,14 +66,14 @@
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>4.0.0</version>
<version>${graphql-spring-boot-starter.version}</version>
</dependency>

<!-- to embed GraphiQL tool -->
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphiql-spring-boot-starter</artifactId>
<version>4.0.0</version>
<version>${graphiql-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
Expand Down Expand Up @@ -123,13 +124,12 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>4.3.0</version>
<version>${graphql-java-tools.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand All @@ -140,9 +140,23 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<version>${hamcrest-all.version}</version>
<scope>test</scope>
</dependency>

<!-- JAXB and Activation added for Java 11 and 17 compatibility.
The JAXB API is considered to be Java EE API and therefore is
no longer contained on the default class path in Java SE 9 -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb-runtime.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.springframework.samples.petclinic.model;

import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package org.springframework.samples.petclinic.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.springframework.samples.petclinic.model;

import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package org.springframework.samples.petclinic.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface OwnerRepository {
* @return the <code>Owner</code> if found
* @throws org.springframework.dao.DataRetrievalFailureException if not found
*/
Owner findById(int id) throws DataAccessException;
Owner findById(Integer id) throws DataAccessException;


/**
Expand All @@ -63,28 +63,28 @@ public interface OwnerRepository {
* @see BaseEntity#isNew
*/
void save(Owner owner) throws DataAccessException;

/**
* Retrieve <code>Owner</code>s from the data store, returning all owners
* Retrieve <code>Owner</code>s from the data store, returning all owners
*
* @return a <code>Collection</code> of <code>Owner</code>s (or an empty <code>Collection</code> if none
* found)
*/
Collection<Owner> findAll() throws DataAccessException;

/**
* Retrieve <code>Owner</code>s from the data store with optional filter or order, returning retrieved owners
* Retrieve <code>Owner</code>s from the data store with optional filter or order, returning retrieved owners
*
* @return a <code>Collection</code> of <code>Owner</code>s (or an empty <code>Collection</code> if none
* found)
*/
Collection<Owner> findAllByFilterOrder(OwnerFilter filter, List<OwnerOrder> orders) throws DataAccessException;

/**
* Delete an <code>Owner</code> to the data store by <code>Owner</code>.
*
* @param owner the <code>Owner</code> to delete
*
*
*/
void delete(Owner owner) throws DataAccessException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface PetRepository {
* @return the <code>Pet</code> if found
* @throws org.springframework.dao.DataRetrievalFailureException if not found
*/
Pet findById(int id) throws DataAccessException;
Pet findById(Integer id) throws DataAccessException;

/**
* Save a <code>Pet</code> to the data store, either inserting or updating it.
Expand All @@ -58,9 +58,9 @@ public interface PetRepository {
* @see BaseEntity#isNew
*/
void save(Pet pet) throws DataAccessException;

/**
* Retrieve <code>Pet</code>s from the data store, returning all owners
* Retrieve <code>Pet</code>s from the data store, returning all owners
*
* @return a <code>Collection</code> of <code>Pet</code>s (or an empty <code>Collection</code> if none
* found)
Expand All @@ -71,7 +71,7 @@ public interface PetRepository {
* Delete an <code>Pet</code> to the data store by <code>Pet</code>.
*
* @param pet the <code>Pet</code> to delete
*
*
*/
void delete(Pet pet) throws DataAccessException;

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

public interface PetTypeRepository {
PetType findById(int id) throws DataAccessException;

PetType findById(Integer id) throws DataAccessException;

Collection<PetType> findAll() throws DataAccessException;

void save(PetType petType) throws DataAccessException;

void delete(PetType petType) throws DataAccessException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
*/

public interface SpecialtyRepository {
Specialty findById(int id) throws DataAccessException;

Specialty findById(Integer id) throws DataAccessException;

Collection<Specialty> findAll() throws DataAccessException;

void save(Specialty specialty) throws DataAccessException;

void delete(Specialty specialty) throws DataAccessException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public interface VetRepository {
* @return a <code>Collection</code> of <code>Vet</code>s
*/
Collection<Vet> findAll() throws DataAccessException;
Vet findById(int id) throws DataAccessException;

Vet findById(Integer id) throws DataAccessException;

void save(Vet vet) throws DataAccessException;

void delete(Vet vet) throws DataAccessException;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public interface VisitRepository {
void save(Visit visit) throws DataAccessException;

List<Visit> findByPetId(Integer petId);
Visit findById(int id) throws DataAccessException;

Visit findById(Integer id) throws DataAccessException;

Collection<Visit> findAll() throws DataAccessException;

void delete(Visit visit) throws DataAccessException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Collection<Owner> findByLastName(String lastName) throws DataAccessExcept
* for the corresponding owner, if not already loaded.
*/
@Override
public Owner findById(int id) throws DataAccessException {
public Owner findById(Integer id) throws DataAccessException {
Owner owner;
try {
Map<String, Object> params = new HashMap<>();
Expand Down Expand Up @@ -161,7 +161,7 @@ private void loadOwnersPetsAndVisits(List<Owner> owners) {
loadPetsAndVisits(owner);
}
}

@Override
public Collection<Owner> findAll() throws DataAccessException {
List<Owner> owners = this.namedParameterJdbcTemplate.query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public List<PetType> findPetTypes() throws DataAccessException {
}

@Override
public Pet findById(int id) throws DataAccessException {
public Pet findById(Integer id) throws DataAccessException {
Integer ownerId;
try {
Map<String, Object> params = new HashMap<>();
Expand Down Expand Up @@ -126,7 +126,7 @@ private MapSqlParameterSource createPetParameterSource(Pet pet) {
.addValue("type_id", pet.getType().getId())
.addValue("owner_id", pet.getOwner().getId());
}

@Override
public Collection<Pet> findAll() throws DataAccessException {
Map<String, Object> params = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
@Repository
@Profile("jdbc")
public class JdbcPetTypeRepositoryImpl implements PetTypeRepository {

private NamedParameterJdbcTemplate namedParameterJdbcTemplate;

private SimpleJdbcInsert insertPetType;

@Autowired
public JdbcPetTypeRepositoryImpl(DataSource dataSource) {
this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
Expand All @@ -61,7 +61,7 @@ public JdbcPetTypeRepositoryImpl(DataSource dataSource) {
}

@Override
public PetType findById(int id) {
public PetType findById(Integer id) {
PetType petType;
try {
Map<String, Object> params = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
@Repository
@Profile("jdbc")
public class JdbcSpecialtyRepositoryImpl implements SpecialtyRepository {

private NamedParameterJdbcTemplate namedParameterJdbcTemplate;

private SimpleJdbcInsert insertSpecialty;

@Autowired
Expand All @@ -57,7 +57,7 @@ public JdbcSpecialtyRepositoryImpl(DataSource dataSource) {
}

@Override
public Specialty findById(int id) {
public Specialty findById(Integer id) {
Specialty specialty;
try {
Map<String, Object> params = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public Integer mapRow(ResultSet rs, int row) throws SQLException {
}
return vets;
}

@Override
public Vet findById(int id) throws DataAccessException {
public Vet findById(Integer id) throws DataAccessException {
Vet vet;
try {
Map<String, Object> vet_params = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public List<Visit> findByPetId(Integer petId) {

return visits;
}

@Override
public Visit findById(int id) throws DataAccessException {
public Visit findById(Integer id) throws DataAccessException {
Visit visit;
try {
Map<String, Object> params = new HashMap<>();
Expand Down
Loading