diff --git a/spring-boot-persistence/pom.xml b/spring-boot-persistence/pom.xml
index a16d953581..08989edfa9 100644
--- a/spring-boot-persistence/pom.xml
+++ b/spring-boot-persistence/pom.xml
@@ -1,57 +1,75 @@
-
- 4.0.0
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-boot-persistence
+ 0.1.0
+
+
+ parent-boot-2
com.baeldung
- spring-boot-persistence
0.0.1-SNAPSHOT
- jar
- spring-boot-persistence
- This is a simple Spring Data Repositories test
-
-
- parent-boot-2
- com.baeldung
- 0.0.1-SNAPSHOT
- ../parent-boot-2
-
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- com.h2database
- h2
-
-
- org.springframework.boot
- spring-boot-starter
-
-
-
-
- spring-boot-persistence
-
-
- src/main/resources
- true
-
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
-
- pl.project13.maven
- git-commit-id-plugin
- ${git-commit-id-plugin.version}
-
-
-
-
-
- 2.2.4
-
-
\ No newline at end of file
+ ../parent-boot-2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ com.zaxxer
+ HikariCP
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.apache.tomcat
+ tomcat-jdbc
+ ${tomcat-jdbc.version}
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector-java.version}
+
+
+ com.h2database
+ h2
+ ${h2database.version}
+ runtime
+
+
+
+
+ UTF-8
+ 1.8
+ 8.0.12
+ 9.0.10
+ 1.4.197
+
+
+
+ spring-boot-persistence
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
new file mode 100644
index 0000000000..ff37442cd4
--- /dev/null
+++ b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
@@ -0,0 +1,22 @@
+package com.baeldung.tomcatconnectionpool.application;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@EnableAutoConfiguration
+@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"})
+@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories")
+@EnableTransactionManagement
+@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities")
+public class SpringBootConsoleApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootConsoleApplication.class);
+ }
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
new file mode 100644
index 0000000000..4003d5aca9
--- /dev/null
+++ b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
@@ -0,0 +1,53 @@
+package com.baeldung.tomcatconnectionpool.application.entities;
+
+import javax.persistence.Column;
+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;
+ @Column(name = "first_name")
+ private String firstName;
+ @Column(name = "last_name")
+ private String lastName;
+
+ public Customer() {}
+
+ public Customer(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ @Override
+ public String toString() {
+ return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}';
+ }
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
new file mode 100644
index 0000000000..770906439c
--- /dev/null
+++ b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
@@ -0,0 +1,12 @@
+package com.baeldung.tomcatconnectionpool.application.repositories;
+
+import com.baeldung.tomcatconnectionpool.application.entities.Customer;
+import java.util.List;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CustomerRepository extends CrudRepository {
+
+ List findByLastName(String lastName);
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
new file mode 100644
index 0000000000..9666bac5a5
--- /dev/null
+++ b/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
@@ -0,0 +1,37 @@
+package com.baeldung.tomcatconnectionpool.application.runners;
+
+import com.baeldung.tomcatconnectionpool.application.entities.Customer;
+import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CommandLineCrudRunner implements CommandLineRunner {
+
+ private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class);
+
+ @Autowired
+ private CustomerRepository customerRepository;
+
+ @Override
+ public void run(String... args) throws Exception {
+ customerRepository.save(new Customer("John", "Doe"));
+ customerRepository.save(new Customer("Jennifer", "Wilson"));
+
+ logger.info("Customers found with findAll():");
+ customerRepository.findAll().forEach(c -> logger.info(c.toString()));
+
+ logger.info("Customer found with findById(1L):");
+ Customer customer = customerRepository.findById(1L)
+ .orElseGet(() -> new Customer("Non-existing customer", ""));
+ logger.info(customer.toString());
+
+ logger.info("Customer found with findByLastName('Wilson'):");
+ customerRepository.findByLastName("Wilson").forEach(c -> {
+ logger.info(c.toString());
+ });
+ }
+}
diff --git a/spring-boot-persistence/src/main/resources/application.properties b/spring-boot-persistence/src/main/resources/application.properties
index d0fb785fe8..303ce33c25 100644
--- a/spring-boot-persistence/src/main/resources/application.properties
+++ b/spring-boot-persistence/src/main/resources/application.properties
@@ -1,2 +1,16 @@
-spring.jpa.show-sql=true
-spring.jpa.hibernate.ddl-auto=none
\ No newline at end of file
+spring.datasource.tomcat.initial-size=15
+spring.datasource.tomcat.max-wait=20000
+spring.datasource.tomcat.max-active=50
+spring.datasource.tomcat.max-idle=15
+spring.datasource.tomcat.min-idle=8
+spring.datasource.tomcat.default-auto-commit=true
+spring.datasource.url=jdbc:h2:mem:test
+spring.datasource.username=root
+spring.datasource.password=
+spring.datasource.driver-class-name=org.h2.Driver
+
+spring.jpa.show-sql=false
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
+spring.jpa.properties.hibernate.id.new_generator_mappings=false
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java b/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
new file mode 100644
index 0000000000..c68e137fb0
--- /dev/null
+++ b/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
@@ -0,0 +1,22 @@
+package com.baeldung.tomcatconnectionpool.test.application;
+
+import javax.sql.DataSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.junit4.SpringRunner;
+import static org.assertj.core.api.Assertions.*;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringBootTomcatConnectionPoolIntegrationTest {
+
+ @Autowired
+ private DataSource dataSource;
+
+ @Test
+ public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() {
+ assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource");
+ }
+}