diff --git a/build.gradle b/build.gradle index 09f1083..d1d1d68 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:2.7.18") } } @@ -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 = 11 +targetCompatibility = 11 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") + runtimeOnly("com.h2database:h2") + testImplementation("junit:junit") } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a2ff3cc..03a8d13 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-7.6.4-bin.zip diff --git a/pom.xml b/pom.xml index 63f5cbd..ab34cd2 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 + 2.7.18 - - org.springframework.boot - spring-boot-properties-migrator - runtime - org.springframework.boot spring-boot-starter-web @@ -35,7 +30,7 @@ - 1.8 + 11 diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java index 7cf8faf..a6662b7 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