diff --git a/build.gradle b/build.gradle
index 09f1083..5c8c142 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,32 +1,24 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
- }
+plugins {
+ id 'java'
+ id 'eclipse'
+ id 'idea'
+ id 'org.springframework.boot' version '3.2.5'
+ id 'io.spring.dependency-management' version '1.1.5'
}
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-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 = 17
+targetCompatibility = 17
dependencies {
- compile("org.springframework.boot:spring-boot-starter-web")
- testCompile("junit:junit")
+ implementation("org.springframework.boot:spring-boot-starter-web")
+ testImplementation("junit:junit")
}
-
diff --git a/pom.xml b/pom.xml
index 63f5cbd..f0b6dbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,13 +5,13 @@
org.springframework
gs-spring-boot
- pom
+ jar
0.1.0
org.springframework.boot
spring-boot-starter-parent
- 2.0.2.RELEASE
+ 3.2.5
@@ -35,7 +35,7 @@
- 1.8
+ 17
diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java
index 7cf8faf..5abd411 100644
--- a/src/main/java/hello/Application.java
+++ b/src/main/java/hello/Application.java
@@ -1,88 +1,12 @@
package hello;
-import java.util.Arrays;
-import java.util.List;
-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 {
-
- private static final Logger log = LoggerFactory.getLogger(Application.class);
+public class Application {
public static void main(String[] args) {
-
- ApplicationContext ctx = SpringApplication.run(Application.class, args);
-
- System.out.println("Let's inspect the beans provided by Spring Boot:");
-
- String[] beanNames = ctx.getBeanDefinitionNames();
- Arrays.sort(beanNames);
- for (String beanName : beanNames) {
- 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());
- };
- }
-
-
- @Autowired
- JdbcTemplate jdbcTemplate;
-
- @Override
- public void run(String... args) throws Exception {
- log.info("Creating tables");
-
- jdbcTemplate.execute("DROP TABLE customers IF EXISTS");
- 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
- List