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 Cloud 2022.2, Spring Boot 3 and Java 17 #217 #221

Merged
merged 21 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
beafa3f
Use Github Actions for CI
arey Oct 21, 2021
0711261
Merge branch 'master' of https://github.com/arey/spring-petclinic-mic…
arey Oct 22, 2021
cb1f5d2
Merge remote-tracking branch 'upstream/master'
arey Oct 31, 2021
278e02d
Merge branch 'spring-petclinic:master' into master
arey Dec 14, 2021
6fba36a
Merge branch 'spring-petclinic:master' into master
arey Dec 16, 2021
0307081
Merge remote-tracking branch 'upstream/master'
arey Mar 22, 2022
6132443
Merge remote-tracking branch 'upstream/master'
arey Mar 25, 2022
8f6684d
Bump to Spring Cloud 2022.0.0-M1 and Spring Boot 3.0.0-M1
arey Mar 25, 2022
14ac685
Bump to Spring Cloud 2022.0.0 and Spring Boot 3.0.1
arey Dec 24, 2022
f797e66
Move from javax to jakarta package
arey Dec 24, 2022
3771233
Artefact mysql-connector-java relocated to com.mysql:mysql-connector-j
arey Dec 24, 2022
a12fd2c
Upgrade Java CI to Java 17
arey Dec 24, 2022
27a6442
Spring Cloud Sleuth migrated to Micrometer Tracing
arey Dec 25, 2022
289360c
Spring Cloud Sleuth migrated to Micrometer Tracing
arey Dec 25, 2022
f7fe9ef
Bump to Spring Boot Admin 3.0.0-M8
arey Dec 25, 2022
4b51dcf
Switch vers cache from ehchace to caffeine
arey Dec 25, 2022
2c3ee23
Dockerfile now use eclipse-temurin:17
arey Dec 25, 2022
7705706
Add MetricConfig because Micrometer’s Spring Boot configuration does …
arey Dec 26, 2022
c6657ff
Eclipse Temurin with Java 17 as Docker base image
arey Dec 26, 2022
30a03e6
Upgrade Grafana Petclinic dashboard JSON config with RestController m…
arey Dec 26, 2022
84d01d8
Remove the unused spring-boot.version property
arey Dec 26, 2022
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
7 changes: 5 additions & 2 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: ${{matrix.java}}
distribution: 'adopt'
cache: maven
- name: Build with Maven
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ After starting services, it takes a while for API Gateway to be in sync with ser
so don't be scared of initial Spring Cloud Gateway timeouts. You can track services availability using Eureka dashboard
available by default at http://localhost:8761.

The `master` branch uses an Alpine linux with JRE 8 as Docker base. You will find a Java 11 version in the `release/java11` branch.
The `master` branch uses an Eclipse Temurin with Java 17 as Docker base image.

*NOTE: Under MacOSX or Windows, make sure that the Docker VM has enough memory to run the microservices. The default settings
are usually not enough and make the `docker-compose up` painfully slow.*
Expand Down
5 changes: 2 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11-jre as builder
FROM eclipse-temurin:17 as builder
WORKDIR application
ARG ARTIFACT_NAME
COPY ${ARTIFACT_NAME}.jar application.jar
Expand All @@ -11,8 +11,7 @@ RUN tar xzf dockerize.tar.gz
RUN chmod +x dockerize


# wget is not installed on adoptopenjdk:11-jre-hotspot
FROM adoptopenjdk:11-jre-hotspot
FROM eclipse-temurin:17

WORKDIR application

Expand Down
16 changes: 8 additions & 8 deletions docker/grafana/dashboards/grafana-petclinic-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"tableColumn": "",
"targets": [
{
"expr": "sum(petclinic_owner_seconds_count{method=\"PUT\", status=\"204\"})",
"expr": "sum(petclinic_owner_seconds_count{method=\"updateOwner\", exception=\"none\"})",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
Expand Down Expand Up @@ -364,7 +364,7 @@
"tableColumn": "",
"targets": [
{
"expr": "sum(petclinic_owner_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_owner_seconds_count{method=\"createOwner\", exception=\"none\"})",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
Expand Down Expand Up @@ -446,7 +446,7 @@
"tableColumn": "",
"targets": [
{
"expr": "sum(petclinic_pet_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_pet_seconds_count{method=\"processCreationForm\", exception=\"none\"})",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
Expand Down Expand Up @@ -528,7 +528,7 @@
"tableColumn": "Value",
"targets": [
{
"expr": "sum(petclinic_visit_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_visit_seconds_count{method=\"read\", exception=\"none\"})",
"format": "time_series",
"instant": true,
"intervalFactor": 1,
Expand Down Expand Up @@ -590,29 +590,29 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(petclinic_owner_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_owner_seconds_count{method=\"createOwner\", exception=\"none\"})",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "owner create",
"refId": "A"
},
{
"expr": "sum(petclinic_pet_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_pet_seconds_count{method=\"processCreationForm\", exception=\"none\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "pet create",
"refId": "B"
},
{
"expr": "sum(petclinic_visit_seconds_count{method=\"POST\", status=\"201\"})",
"expr": "sum(petclinic_visit_seconds_count{method=\"create\", exception=\"none\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "visit create",
"refId": "C"
},
{
"expr": "sum(petclinic_owner_seconds_count{method=\"PUT\", status=\"204\"})",
"expr": "sum(petclinic_owner_seconds_count{method=\"updateOwner\", exception=\"none\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "owner update",
Expand Down
19 changes: 12 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
</parent>

<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>

Expand All @@ -26,12 +26,12 @@
</modules>

<properties>
<java.version>1.8</java.version>
<java.version>17</java.version>
<assertj.version>3.17.1</assertj.version>

<spring-boot.version>2.6.0</spring-boot.version>
<spring-cloud.version>2021.0.2</spring-cloud.version>
<spring-cloud.version>2022.0.0</spring-cloud.version>
<chaos-monkey-spring-boot.version>2.3.10</chaos-monkey-spring-boot.version>
<jolokia-core.version>1.7.1</jolokia-core.version>

<docker.image.prefix>springcommunity</docker.image.prefix>
<docker.image.exposed.port>9090</docker.image.exposed.port>
Expand All @@ -54,6 +54,11 @@
<artifactId>chaos-monkey-spring-boot</artifactId>
<version>${chaos-monkey-spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
<version>${jolokia-core.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -97,8 +102,8 @@

<!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties file is present -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<executions>
<execution>
<goals>
Expand Down
4 changes: 2 additions & 2 deletions spring-petclinic-admin-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
</parent>

<properties>
<spring-boot-admin.version>2.5.4</spring-boot-admin.version>
<spring-boot-admin.version>3.0.0-M8</spring-boot-admin.version>
<docker.image.exposed.port>9090</docker.image.exposed.port>
<docker.image.dockerfile.dir>${basedir}/../docker</docker.image.dockerfile.dir>
</properties>
Expand Down
14 changes: 5 additions & 9 deletions spring-petclinic-api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
</parent>

<properties>
Expand Down Expand Up @@ -47,10 +47,6 @@
</dependency>

<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
Expand All @@ -63,10 +59,6 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
Expand All @@ -90,6 +82,10 @@
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-micrometer</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>

<!-- Webjars -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion spring-petclinic-config-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
</parent>

<properties>
Expand Down
18 changes: 7 additions & 11 deletions spring-petclinic-customers-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>2.6.7</version>
<version>3.0.1</version>
</parent>

<properties>
Expand Down Expand Up @@ -49,19 +49,11 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>

<!-- Third parties -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand All @@ -86,6 +78,10 @@
<groupId>de.codecentric</groupId>
<artifactId>chaos-monkey-spring-boot</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>

<!-- Testing -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.springframework.samples.petclinic.customers.config;

import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MetricConfig {

@Bean
MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config().commonTags("application", "petclinic");
}

@Bean
TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotBlank;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

/**
* @author Juergen Hoeller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.springframework.samples.petclinic.customers.model.OwnerRepository;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import java.util.List;
import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.Date;

import javax.validation.constraints.Size;
import jakarta.validation.constraints.Size;

import com.fasterxml.jackson.annotation.JsonFormat;

Expand Down
Loading