From 9c9203a9f0acd4e0e8665cb7d7a2bc36fb4e80c7 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 12 Jul 2020 11:03:52 +0200 Subject: [PATCH] WIP --- .../de/trion/kafka/outbox/Application.java | 18 +----------------- src/main/resources/schema-h2.sql | 1 + 2 files changed, 2 insertions(+), 17 deletions(-) create mode 100644 src/main/resources/schema-h2.sql diff --git a/src/main/java/de/trion/kafka/outbox/Application.java b/src/main/java/de/trion/kafka/outbox/Application.java index a5d739c..878e75e 100644 --- a/src/main/java/de/trion/kafka/outbox/Application.java +++ b/src/main/java/de/trion/kafka/outbox/Application.java @@ -3,28 +3,22 @@ package de.trion.kafka.outbox; 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.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Component; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication @EnableConfigurationProperties(ApplicationProperties.class) -@Component -public class Application implements CommandLineRunner { +public class Application { private final static Logger LOG = LoggerFactory.getLogger(Application.class); @Autowired ApplicationProperties properties; - @Autowired - JdbcTemplate jdbcTemplate; @Bean @@ -53,17 +47,7 @@ public class Application implements CommandLineRunner { } - @Override - public void run(String... strings) throws Exception { - - LOG.info("Creating tables"); - jdbcTemplate.execute("DROP TABLE users IF EXISTS"); - jdbcTemplate.execute("CREATE TABLE users(id SERIAL, username VARCHAR(255), loggedIn BOOLEAN)"); - } - - public static void main(String[] args) { SpringApplication.run(Application.class, args); } - } diff --git a/src/main/resources/schema-h2.sql b/src/main/resources/schema-h2.sql new file mode 100644 index 0000000..02cc4b1 --- /dev/null +++ b/src/main/resources/schema-h2.sql @@ -0,0 +1 @@ +CREATE TABLE users(id BIGINT PRIMARY KEY AUTO_INCREMENT, username VARCHAR(255), created TIMESTAMP, loggedIn BIT) -- 2.20.1