Skip to content

Commit 9cdb898

Browse files
Ramesh FadatareRamesh Fadatare
Ramesh Fadatare
authored and
Ramesh Fadatare
committed
Upgraded to Spring Boot 3 and Java 17
1 parent 7e4800f commit 9cdb898

File tree

105 files changed

+618
-471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+618
-471
lines changed

spring-aop-advice-examples/pom.xml

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
<parent>
1616
<groupId>org.springframework.boot</groupId>
1717
<artifactId>spring-boot-starter-parent</artifactId>
18-
<version>2.1.4.RELEASE</version>
18+
<version>3.0.4</version>
1919
<relativePath /> <!-- lookup parent from repository -->
2020
</parent>
2121

2222
<properties>
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
25-
<java.version>1.8</java.version>
25+
<java.version>17</java.version>
2626
</properties>
2727

2828
<dependencies>
@@ -44,7 +44,10 @@
4444
<groupId>org.springframework.boot</groupId>
4545
<artifactId>spring-boot-starter-aop</artifactId>
4646
</dependency>
47-
47+
<dependency>
48+
<groupId>org.springframework.boot</groupId>
49+
<artifactId>spring-boot-starter-validation</artifactId>
50+
</dependency>
4851
<dependency>
4952
<groupId>org.springframework.boot</groupId>
5053
<artifactId>spring-boot-devtools</artifactId>

spring-aop-advice-examples/src/main/java/net/guides/springboot2/springboot2jpacrudexample/controller/EmployeeController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.List;
44
import java.util.Map;
55

6-
import javax.validation.Valid;
6+
import jakarta.validation.Valid;
77

88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.http.ResponseEntity;

spring-aop-advice-examples/src/main/java/net/guides/springboot2/springboot2jpacrudexample/model/Employee.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package net.guides.springboot2.springboot2jpacrudexample.model;
22

3-
import javax.persistence.Column;
4-
import javax.persistence.Entity;
5-
import javax.persistence.GeneratedValue;
6-
import javax.persistence.GenerationType;
7-
import javax.persistence.Id;
8-
import javax.persistence.Table;
3+
import jakarta.persistence.*;
94

105
@Entity
116
@Table(name = "employees")

spring-boot-crud-rest/pom.xml

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.4.RELEASE</version>
17+
<version>3.0.4</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
24+
<java.version>17</java.version>
2525
</properties>
2626

2727
<dependencies>
@@ -33,15 +33,18 @@
3333
<groupId>org.springframework.boot</groupId>
3434
<artifactId>spring-boot-starter-web</artifactId>
3535
</dependency>
36-
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-validation</artifactId>
39+
</dependency>
3740
<dependency>
3841
<groupId>org.springframework.boot</groupId>
3942
<artifactId>spring-boot-devtools</artifactId>
4043
<scope>runtime</scope>
4144
</dependency>
4245
<dependency>
43-
<groupId>mysql</groupId>
44-
<artifactId>mysql-connector-java</artifactId>
46+
<groupId>com.mysql</groupId>
47+
<artifactId>mysql-connector-j</artifactId>
4548
<scope>runtime</scope>
4649
</dependency>
4750
<dependency>

spring-boot-crud-rest/src/main/java/com/companyname/springbootcrudrest/controller/UserController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.List;
66
import java.util.Map;
77

8-
import javax.validation.Valid;
8+
import jakarta.validation.Valid;
99

1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.http.ResponseEntity;

spring-boot-crud-rest/src/main/java/com/companyname/springbootcrudrest/model/User.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22

33
import java.util.Date;
44

5-
import javax.persistence.Column;
6-
import javax.persistence.Entity;
7-
import javax.persistence.EntityListeners;
8-
import javax.persistence.GeneratedValue;
9-
import javax.persistence.GenerationType;
10-
import javax.persistence.Id;
11-
import javax.persistence.Table;
12-
import javax.persistence.Temporal;
13-
import javax.persistence.TemporalType;
5+
import jakarta.persistence.*;
146

157
import org.springframework.data.annotation.CreatedBy;
168
import org.springframework.data.annotation.CreatedDate;

spring-boot-crud-rest/src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spring.datasource.password = root
66

77
## Hibernate Properties
88
# The SQL dialect makes Hibernate generate better SQL for the chosen database
9-
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
9+
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
1010

1111
# Hibernate ddl auto (create, create-drop, validate, update)
1212
spring.jpa.hibernate.ddl-auto = update

spring-propertysource-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
<parent>
1414
<groupId>org.springframework.boot</groupId>
1515
<artifactId>spring-boot-starter-parent</artifactId>
16-
<version>2.0.5.RELEASE</version>
16+
<version>3.0.4</version>
1717
<relativePath/> <!-- lookup parent from repository -->
1818
</parent>
1919

2020
<properties>
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
23-
<java.version>1.8</java.version>
23+
<java.version>17</java.version>
2424
</properties>
2525

2626
<dependencies>

springboot-async-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.6.RELEASE</version>
17+
<version>3.0.4</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
24+
<java.version>17</java.version>
2525
</properties>
2626

2727
<dependencies>

springboot-crud-hibernate-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.1.0.RELEASE</version>
8+
<version>3.0.4</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>net.javaguides.springboot</groupId>
@@ -15,7 +15,7 @@
1515
<description>spring boot crud operations example with hibernate</description>
1616

1717
<properties>
18-
<java.version>1.8</java.version>
18+
<java.version>17</java.version>
1919
</properties>
2020

2121
<dependencies>

springboot-crud-hibernate-example/src/main/java/net/javaguides/springboot/model/Product.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
import java.math.BigDecimal;
44
import java.util.Date;
55

6-
import javax.persistence.Column;
7-
import javax.persistence.Entity;
8-
import javax.persistence.GeneratedValue;
9-
import javax.persistence.GenerationType;
10-
import javax.persistence.Id;
11-
import javax.persistence.Table;
6+
import jakarta.persistence.*;
127

138
import org.hibernate.annotations.CreationTimestamp;
149

springboot-crud-rest-api-validation/pom.xml

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
@@ -14,14 +14,14 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.5.RELEASE</version>
17+
<version>3.0.4</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
24+
<java.version>17</java.version>
2525
</properties>
2626

2727
<dependencies>
@@ -33,7 +33,10 @@
3333
<groupId>org.springframework.boot</groupId>
3434
<artifactId>spring-boot-starter-web</artifactId>
3535
</dependency>
36-
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-validation</artifactId>
39+
</dependency>
3740
<dependency>
3841
<groupId>org.springframework.boot</groupId>
3942
<artifactId>spring-boot-devtools</artifactId>
@@ -45,8 +48,8 @@
4548
<scope>runtime</scope>
4649
</dependency>
4750
<dependency>
48-
<groupId>mysql</groupId>
49-
<artifactId>mysql-connector-java</artifactId>
51+
<groupId>com.mysql</groupId>
52+
<artifactId>mysql-connector-j</artifactId>
5053
<scope>runtime</scope>
5154
</dependency>
5255
<dependency>

springboot-crud-rest-api-validation/src/main/java/net/guides/springboot/springbootcrudrestapivalidation/controller/EmployeeController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.List;
55
import java.util.Map;
66

7-
import javax.validation.Valid;
7+
import jakarta.validation.Valid;
88

99
import org.springframework.beans.factory.annotation.Autowired;
1010
import org.springframework.http.ResponseEntity;

springboot-crud-rest-api-validation/src/main/java/net/guides/springboot/springbootcrudrestapivalidation/exception/GlobalExceptionHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import org.springframework.http.HttpHeaders;
66
import org.springframework.http.HttpStatus;
7+
import org.springframework.http.HttpStatusCode;
78
import org.springframework.http.ResponseEntity;
89
import org.springframework.web.bind.MethodArgumentNotValidException;
910
import org.springframework.web.bind.annotation.ControllerAdvice;
@@ -27,7 +28,7 @@ public ResponseEntity<?> globleExcpetionHandler(Exception ex, WebRequest request
2728

2829
@Override
2930
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex,
30-
HttpHeaders headers, HttpStatus status, WebRequest request) {
31+
HttpHeaders headers, HttpStatusCode status, WebRequest request) {
3132
ErrorDetails errorDetails = new ErrorDetails(new Date(), "Validation Failed",
3233
ex.getBindingResult().toString());
3334
return new ResponseEntity(errorDetails, HttpStatus.BAD_REQUEST);

springboot-crud-rest-api-validation/src/main/java/net/guides/springboot/springbootcrudrestapivalidation/model/Employee.java

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
package net.guides.springboot.springbootcrudrestapivalidation.model;
22

3-
import javax.persistence.Column;
4-
import javax.persistence.Entity;
5-
import javax.persistence.GeneratedValue;
6-
import javax.persistence.GenerationType;
7-
import javax.persistence.Id;
8-
import javax.persistence.Table;
9-
import javax.validation.constraints.Email;
10-
import javax.validation.constraints.NotBlank;
11-
import javax.validation.constraints.NotNull;
12-
import javax.validation.constraints.Size;
3+
import jakarta.persistence.*;
4+
import jakarta.validation.constraints.Email;
5+
import jakarta.validation.constraints.NotBlank;
6+
import jakarta.validation.constraints.NotNull;
7+
import jakarta.validation.constraints.Size;
138

149
@Entity
1510
@Table(name = "employees")

springboot-hibernate-composite-key-demo/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.2.7.RELEASE</version>
8+
<version>3.0.4</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>net.javaguides</groupId>
@@ -15,7 +15,7 @@
1515
<description>Demo project for Spring Boot and Hibernate </description>
1616

1717
<properties>
18-
<java.version>1.8</java.version>
18+
<java.version>17</java.version>
1919
</properties>
2020

2121
<dependencies>
@@ -25,8 +25,8 @@
2525
</dependency>
2626

2727
<dependency>
28-
<groupId>mysql</groupId>
29-
<artifactId>mysql-connector-java</artifactId>
28+
<groupId>com.mysql</groupId>
29+
<artifactId>mysql-connector-j</artifactId>
3030
<scope>runtime</scope>
3131
</dependency>
3232
<dependency>

springboot-hibernate-composite-key-demo/src/main/java/net/javaguides/springboot/entity/Employee.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package net.javaguides.springboot.entity;
22

3-
import javax.persistence.Column;
4-
import javax.persistence.EmbeddedId;
5-
import javax.persistence.Entity;
6-
import javax.persistence.Table;
3+
import jakarta.persistence.*;
74

85
@Entity
96
@Table(name = "employees")

springboot-hibernate-composite-key-demo/src/main/java/net/javaguides/springboot/entity/EmployeeIdentity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.io.Serializable;
44

5-
import javax.persistence.Embeddable;
5+
import jakarta.persistence.Embeddable;
66

77
@Embeddable
88
public class EmployeeIdentity implements Serializable {

springboot-hibernate-many-to-many-mapping/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.2.6.RELEASE</version>
8+
<version>3.0.4</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>net.javaguides</groupId>
@@ -15,7 +15,7 @@
1515
<description>Demo project for Spring Boot Hibernate many to many mapping</description>
1616

1717
<properties>
18-
<java.version>1.8</java.version>
18+
<java.version>17</java.version>
1919
</properties>
2020

2121
<dependencies>
@@ -25,8 +25,8 @@
2525
</dependency>
2626

2727
<dependency>
28-
<groupId>mysql</groupId>
29-
<artifactId>mysql-connector-java</artifactId>
28+
<groupId>com.mysql</groupId>
29+
<artifactId>mysql-connector-j</artifactId>
3030
<scope>runtime</scope>
3131
</dependency>
3232
<dependency>

springboot-hibernate-many-to-many-mapping/src/main/java/net/javaguides/springboot/entity/Post.java

+1-11
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@
44
import java.util.HashSet;
55
import java.util.Set;
66

7-
import javax.persistence.CascadeType;
8-
import javax.persistence.Column;
9-
import javax.persistence.Entity;
10-
import javax.persistence.FetchType;
11-
import javax.persistence.GeneratedValue;
12-
import javax.persistence.GenerationType;
13-
import javax.persistence.Id;
14-
import javax.persistence.JoinColumn;
15-
import javax.persistence.JoinTable;
16-
import javax.persistence.ManyToMany;
17-
import javax.persistence.Table;
7+
import jakarta.persistence.*;
188

199
/**
2010
* Post domain model

springboot-hibernate-many-to-many-mapping/src/main/java/net/javaguides/springboot/entity/Tag.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
import java.util.HashSet;
44
import java.util.Set;
55

6-
import javax.persistence.CascadeType;
7-
import javax.persistence.Entity;
8-
import javax.persistence.FetchType;
9-
import javax.persistence.GeneratedValue;
10-
import javax.persistence.GenerationType;
11-
import javax.persistence.Id;
12-
import javax.persistence.ManyToMany;
13-
import javax.persistence.Table;
6+
import jakarta.persistence.*;
147

158
/**
169
* Tag domain model

0 commit comments

Comments
 (0)