diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index c954cec..11213b0 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/build.gradle b/build.gradle
index 09f1083..d0d660b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
+ classpath("org.springframework.boot:spring-boot-gradle-plugin:3.3.5")
}
}
@@ -14,19 +14,21 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
- baseName = 'gs-spring-boot'
- version = '0.1.0'
+ archiveBaseName = 'gs-spring-boot'
+ archiveVersion = '0.1.0'
}
repositories {
mavenCentral()
}
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
+sourceCompatibility = 21
+targetCompatibility = 21
dependencies {
- compile("org.springframework.boot:spring-boot-starter-web")
- testCompile("junit:junit")
+ implementation("org.springframework.boot:spring-boot-starter-web")
+ implementation("org.springframework.boot:spring-boot-starter-jdbc")
+ implementation("com.h2database:h2")
+ testImplementation("junit:junit")
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a2ff3cc..0a55694 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
diff --git a/pom.xml b/pom.xml
index 63f5cbd..cb90ba8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,21 +5,16 @@
org.springframework
gs-spring-boot
- pom
+ jar
0.1.0
org.springframework.boot
spring-boot-starter-parent
- 2.0.2.RELEASE
+ 3.3.5
-
- org.springframework.boot
- spring-boot-properties-migrator
- runtime
-
org.springframework.boot
spring-boot-starter-web
@@ -35,7 +30,7 @@
- 1.8
+ 21
diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java
index 7cf8faf..d857e00 100644
--- a/src/main/java/hello/Application.java
+++ b/src/main/java/hello/Application.java
@@ -5,18 +5,14 @@
import java.util.stream.Collectors;
import hello.model.Customer;
-import hello.model.Quote;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class Application implements CommandLineRunner {
@@ -35,24 +31,6 @@ public static void main(String[] args) {
System.out.println(beanName);
}
- RestTemplate restTemplate = new RestTemplate();
- Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
- log.info(quote.toString());
- }
-
-
- @Bean
- public RestTemplate restTemplate(RestTemplateBuilder builder) {
- return builder.build();
- }
-
- @Bean
- public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
- return args -> {
- Quote quote = restTemplate.getForObject(
- "http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
- log.info(quote.toString());
- };
}
@@ -63,7 +41,7 @@ public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
public void run(String... args) throws Exception {
log.info("Creating tables");
- jdbcTemplate.execute("DROP TABLE customers IF EXISTS");
+ jdbcTemplate.execute("DROP TABLE IF EXISTS customers");
jdbcTemplate.execute("CREATE TABLE customers(id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))");
// Split up the array of whole names into an array of first/last names
@@ -80,8 +58,9 @@ public void run(String... args) throws Exception {
log.info("Querying for customer records where first_name = 'Josh':");
jdbcTemplate.query(
- "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[]{"Josh"},
- (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name"))
+ "SELECT id, first_name, last_name FROM customers WHERE first_name = ?",
+ (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")),
+ "Josh"
).forEach(customer -> log.info(customer.toString()));
}