From c2637f15094888501070d52d4e535fa00e54c033 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 9 May 2020 14:56:21 +0200 Subject: [PATCH 1/5] BAEL-1524 Split spring-boot-persistence module --- .../spring-boot-persistence-2/README.md | 4 + .../spring-boot-persistence-2/pom.xml | 17 +++ .../application/Application.java | 24 ++-- .../controllers/CustomerController.java | 65 +++++----- .../application/entities/Customer.java | 110 ++++++++-------- .../repositories/CustomerRepository.java | 16 +-- .../SpringBootConsoleApplication.java | 0 .../application/entities/Customer.java | 0 .../repositories/CustomerRepository.java | 0 .../runners/CommandLineCrudRunner.java | 0 .../resources/persistence-derby.properties | 8 ++ .../persistence-generic-entity.properties | 8 ++ .../resources/persistence-hsqldb.properties | 8 ++ .../resources/persistence-sqlite.properties | 7 + .../tests/CustomerControllerUnitTest.java | 122 +++++++++--------- ...otTomcatConnectionPoolIntegrationTest.java | 0 .../spring-boot-persistence/README.MD | 6 +- 17 files changed, 222 insertions(+), 173 deletions(-) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/springboothsqldb/application/Application.java (96%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java (92%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java (95%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java (97%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java (100%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java (100%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java (100%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java (100%) create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-derby.properties create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-generic-entity.properties create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-hsqldb.properties create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-sqlite.properties rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java (97%) rename persistence-modules/{spring-boot-persistence => spring-boot-persistence-2}/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java (100%) diff --git a/persistence-modules/spring-boot-persistence-2/README.md b/persistence-modules/spring-boot-persistence-2/README.md index 5d171fb2ca..8bf9381093 100644 --- a/persistence-modules/spring-boot-persistence-2/README.md +++ b/persistence-modules/spring-boot-persistence-2/README.md @@ -1,3 +1,7 @@ ### Relevant Articles: - [Using JDBI with Spring Boot](https://www.baeldung.com/spring-boot-jdbi) +- [Configuring a Tomcat Connection Pool in Spring Boot](https://www.baeldung.com/spring-boot-tomcat-connection-pool) +- [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb) +- [List of In-Memory Databases](http://www.baeldung.com/java-in-memory-databases) +- More articles: [[<-- prev]](../spring-boot-persistence) \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-2/pom.xml b/persistence-modules/spring-boot-persistence-2/pom.xml index 9f456fa8af..58432a5c9c 100644 --- a/persistence-modules/spring-boot-persistence-2/pom.xml +++ b/persistence-modules/spring-boot-persistence-2/pom.xml @@ -104,6 +104,23 @@ tomcat-jdbc + + mysql + mysql-connector-java + + + org.xerial + sqlite-jdbc + + + org.apache.derby + derby + + + org.hsqldb + hsqldb + + diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/Application.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/Application.java similarity index 96% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/Application.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/Application.java index c5a5c291c6..bde8346482 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/Application.java +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/Application.java @@ -1,12 +1,12 @@ -package com.baeldung.springboothsqldb.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } -} +package com.baeldung.springboothsqldb.application; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java similarity index 92% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java index 8229a1d1c0..045612a86f 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/controllers/CustomerController.java @@ -1,33 +1,32 @@ -package com.baeldung.springboothsqldb.application.controllers; - -import com.baeldung.springboothsqldb.application.entities.Customer; -import com.baeldung.springboothsqldb.application.repositories.CustomerRepository; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class CustomerController { - - private final CustomerRepository customerRepository; - - @Autowired - public CustomerController(CustomerRepository customerRepository) { - this.customerRepository = customerRepository; - } - - @PostMapping("/customers") - public Customer addCustomer(@RequestBody Customer customer) { - customerRepository.save(customer); - return customer; - } - - @GetMapping("/customers") - public List getCustomers() { - return (List) customerRepository.findAll(); - } -} +package com.baeldung.springboothsqldb.application.controllers; + +import com.baeldung.springboothsqldb.application.entities.Customer; +import com.baeldung.springboothsqldb.application.repositories.CustomerRepository; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class CustomerController { + + private final CustomerRepository customerRepository; + + @Autowired + public CustomerController(CustomerRepository customerRepository) { + this.customerRepository = customerRepository; + } + + @PostMapping("/customers") + public Customer addCustomer(@RequestBody Customer customer) { + customerRepository.save(customer); + return customer; + } + + @GetMapping("/customers") + public List getCustomers() { + return (List) customerRepository.findAll(); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java similarity index 95% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java index 636a80e272..ee2735abb8 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/entities/Customer.java @@ -1,55 +1,55 @@ -package com.baeldung.springboothsqldb.application.entities; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "customers") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - private String name; - private String email; - - public Customer() {} - - public Customer(String name, String email) { - this.name = name; - this.email = email; - } - - public void setId(long id) { - this.id = id; - } - - public long getId() { - return id; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getEmail() { - return email; - } - - @Override - public String toString() { - return "Customer{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; - } -} +package com.baeldung.springboothsqldb.application.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "customers") +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + private String name; + private String email; + + public Customer() {} + + public Customer(String name, String email) { + this.name = name; + this.email = email; + } + + public void setId(long id) { + this.id = id; + } + + public long getId() { + return id; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getEmail() { + return email; + } + + @Override + public String toString() { + return "Customer{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; + } +} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java similarity index 97% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java index a81aa62c43..cc8a045e83 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/springboothsqldb/application/repositories/CustomerRepository.java @@ -1,8 +1,8 @@ -package com.baeldung.springboothsqldb.application.repositories; - -import com.baeldung.springboothsqldb.application.entities.Customer; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CustomerRepository extends CrudRepository {} +package com.baeldung.springboothsqldb.application.repositories; + +import com.baeldung.springboothsqldb.application.entities.Customer; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CustomerRepository extends CrudRepository {} diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java rename to persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java diff --git a/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-derby.properties b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-derby.properties new file mode 100644 index 0000000000..5b5ff05236 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-derby.properties @@ -0,0 +1,8 @@ +jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver +jdbc.url=jdbc:derby:memory:myD;create=true +jdbc.user=sa +jdbc.pass= + +hibernate.dialect=org.hibernate.dialect.DerbyDialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-generic-entity.properties b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-generic-entity.properties new file mode 100644 index 0000000000..b19304cb1f --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-generic-entity.properties @@ -0,0 +1,8 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.pass=sa + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop diff --git a/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-hsqldb.properties b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-hsqldb.properties new file mode 100644 index 0000000000..d045a8b7e5 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-hsqldb.properties @@ -0,0 +1,8 @@ +jdbc.driverClassName=org.hsqldb.jdbc.JDBCDriver +jdbc.url=jdbc:hsqldb:mem:myDb +jdbc.user=sa +jdbc.pass= + +hibernate.dialect=org.hibernate.dialect.HSQLDialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-sqlite.properties b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-sqlite.properties new file mode 100644 index 0000000000..ee16081603 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/resources/persistence-sqlite.properties @@ -0,0 +1,7 @@ +jdbc.driverClassName=org.sqlite.JDBC +jdbc.url=jdbc:sqlite:memory:myDb?cache=shared +jdbc.user=sa +jdbc.pass=sa +hibernate.dialect=com.baeldung.dialect.SQLiteDialect +hibernate.hbm2ddl.auto=create-drop +hibernate.show_sql=true diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java similarity index 97% rename from persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java rename to persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java index 33891e3d43..be16f8f563 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java +++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/springboothsqldb/application/tests/CustomerControllerUnitTest.java @@ -1,61 +1,61 @@ -package com.baeldung.springboothsqldb.application.tests; - -import com.baeldung.springboothsqldb.application.entities.Customer; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializationFeature; -import java.nio.charset.Charset; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; - -@RunWith(SpringRunner.class) -@SpringBootTest -@AutoConfigureMockMvc -public class CustomerControllerUnitTest { - - private static MediaType MEDIA_TYPE_JSON; - - @Autowired - private MockMvc mockMvc; - - @Before - public void setUpJsonMediaType() { - MEDIA_TYPE_JSON = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - } - - @Test - public void whenPostHttpRequesttoCustomers_thenStatusOK() throws Exception { - Customer customer = new Customer("John", "john@domain.com"); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - ObjectWriter objectWriter = mapper.writer().withDefaultPrettyPrinter(); - String requestJson = objectWriter.writeValueAsString(customer); - - this.mockMvc - .perform(MockMvcRequestBuilders.post("/customers") - .contentType(MEDIA_TYPE_JSON) - .content(requestJson) - ) - - .andExpect(MockMvcResultMatchers.status().isOk()); - } - - @Test - public void whenGetHttpRequesttoCustomers_thenStatusOK() throws Exception { - this.mockMvc - .perform(MockMvcRequestBuilders.get("/customers")) - - .andExpect(MockMvcResultMatchers.content().contentType(MEDIA_TYPE_JSON)) - .andExpect(MockMvcResultMatchers.status().isOk()); - } -} +package com.baeldung.springboothsqldb.application.tests; + +import com.baeldung.springboothsqldb.application.entities.Customer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.SerializationFeature; +import java.nio.charset.Charset; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureMockMvc +public class CustomerControllerUnitTest { + + private static MediaType MEDIA_TYPE_JSON; + + @Autowired + private MockMvc mockMvc; + + @Before + public void setUpJsonMediaType() { + MEDIA_TYPE_JSON = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); + + } + + @Test + public void whenPostHttpRequesttoCustomers_thenStatusOK() throws Exception { + Customer customer = new Customer("John", "john@domain.com"); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + ObjectWriter objectWriter = mapper.writer().withDefaultPrettyPrinter(); + String requestJson = objectWriter.writeValueAsString(customer); + + this.mockMvc + .perform(MockMvcRequestBuilders.post("/customers") + .contentType(MEDIA_TYPE_JSON) + .content(requestJson) + ) + + .andExpect(MockMvcResultMatchers.status().isOk()); + } + + @Test + public void whenGetHttpRequesttoCustomers_thenStatusOK() throws Exception { + this.mockMvc + .perform(MockMvcRequestBuilders.get("/customers")) + + .andExpect(MockMvcResultMatchers.content().contentType(MEDIA_TYPE_JSON)) + .andExpect(MockMvcResultMatchers.status().isOk()); + } +} diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java similarity index 100% rename from persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java rename to persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java diff --git a/persistence-modules/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD index 96eb326cbe..d6ef239448 100644 --- a/persistence-modules/spring-boot-persistence/README.MD +++ b/persistence-modules/spring-boot-persistence/README.MD @@ -3,10 +3,8 @@ - [Spring Boot with Multiple SQL Import Files](http://www.baeldung.com/spring-boot-sql-import-files) - [Configuring Separate Spring DataSource for Tests](http://www.baeldung.com/spring-testing-separate-data-source) - [Quick Guide on Loading Initial Data with Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) -- [Configuring a Tomcat Connection Pool in Spring Boot](https://www.baeldung.com/spring-boot-tomcat-connection-pool) -- [Hibernate Field Naming with Spring Boot](https://www.baeldung.com/hibernate-field-naming-spring-boot) -- [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb) - [Configuring a DataSource Programmatically in Spring Boot](https://www.baeldung.com/spring-boot-configure-data-source-programmatic) - [Resolving “Failed to Configure a DataSource” Error](https://www.baeldung.com/spring-boot-failed-to-configure-data-source) +- [Hibernate Field Naming with Spring Boot](https://www.baeldung.com/hibernate-field-naming-spring-boot) - [Spring Boot with Hibernate](https://www.baeldung.com/spring-boot-hibernate) -- [List of In-Memory Databases](http://www.baeldung.com/java-in-memory-databases) \ No newline at end of file +- More articles: [[more -->]](../spring-boot-persistence-2) \ No newline at end of file From 958435e0b3ab23725010544c8ad2c307c490f6fb Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 16 May 2020 17:04:21 +0200 Subject: [PATCH 2/5] BAEL-1524 Add HikariCP exclusion to Spring Boot Data JPA dependency --- persistence-modules/spring-boot-persistence-2/pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-boot-persistence-2/pom.xml b/persistence-modules/spring-boot-persistence-2/pom.xml index 58432a5c9c..b5cdfbafc9 100644 --- a/persistence-modules/spring-boot-persistence-2/pom.xml +++ b/persistence-modules/spring-boot-persistence-2/pom.xml @@ -49,6 +49,12 @@ org.springframework.boot spring-boot-starter-data-jpa + + + com.zaxxer + HikariCP + + @@ -120,7 +126,6 @@ org.hsqldb hsqldb - From 3d9c2403ab8a6d5ab2d6c0b1ecfee173469a890b Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 16 May 2020 17:17:21 +0200 Subject: [PATCH 3/5] BAEL-1524 Put back HikariCP --- persistence-modules/spring-boot-persistence/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml index c58e8dbf86..99c00f6784 100644 --- a/persistence-modules/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -26,12 +26,6 @@ org.springframework.boot spring-boot-starter-data-jpa - - - com.zaxxer - HikariCP - - org.springframework.boot From 94ed56e4f5410c7c478e23150ed858f89803e8f8 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 16 May 2020 17:21:28 +0200 Subject: [PATCH 4/5] BAEL-1524 Put back HikariCP --- persistence-modules/spring-boot-persistence-2/pom.xml | 6 ------ persistence-modules/spring-boot-persistence/pom.xml | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/persistence-modules/spring-boot-persistence-2/pom.xml b/persistence-modules/spring-boot-persistence-2/pom.xml index b5cdfbafc9..33b33d7160 100644 --- a/persistence-modules/spring-boot-persistence-2/pom.xml +++ b/persistence-modules/spring-boot-persistence-2/pom.xml @@ -49,12 +49,6 @@ org.springframework.boot spring-boot-starter-data-jpa - - - com.zaxxer - HikariCP - - diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml index 99c00f6784..c58e8dbf86 100644 --- a/persistence-modules/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -26,6 +26,12 @@ org.springframework.boot spring-boot-starter-data-jpa + + + com.zaxxer + HikariCP + + org.springframework.boot From dca1a9fb3f644731d5b41b13d0c55f08a00beed4 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 16 May 2020 18:20:33 +0200 Subject: [PATCH 5/5] BAEL-1524 Fix test --- .../spring-boot-persistence-2/src/test/resources/schema.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/persistence-modules/spring-boot-persistence-2/src/test/resources/schema.sql b/persistence-modules/spring-boot-persistence-2/src/test/resources/schema.sql index a0d0eaf62e..8d7db6c9f3 100644 --- a/persistence-modules/spring-boot-persistence-2/src/test/resources/schema.sql +++ b/persistence-modules/spring-boot-persistence-2/src/test/resources/schema.sql @@ -1,3 +1,6 @@ +drop table if exists car_maker; +drop table if exists car_model; + -- -- Car makers table --