diff --git a/README.md b/README.md
index 1fcebba..222cb5d 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1 @@
-# druid-spring-boot
-Spring Boot Starter for Druid
+# Druid Spring Boot Starter
diff --git a/druid-spring-boot-autoconfigure/pom.xml b/druid-spring-boot-autoconfigure/pom.xml
index 61b800b..1c22cca 100644
--- a/druid-spring-boot-autoconfigure/pom.xml
+++ b/druid-spring-boot-autoconfigure/pom.xml
@@ -11,7 +11,7 @@
druid-spring-boot-autoconfigure
- druid-spring-boot-autoconfigure
+ ${project.artifactId}
diff --git a/druid-spring-boot-samples/pom.xml b/druid-spring-boot-samples/pom.xml
index f88841e..c9f7d9e 100644
--- a/druid-spring-boot-samples/pom.xml
+++ b/druid-spring-boot-samples/pom.xml
@@ -1,15 +1,58 @@
-
-
- druid-spring-boot
- com.github.drtrang
- 1.0.0
-
4.0.0
- druid-spring-boot-samples
+
+ com.github.drtrang
+ druid-spring-boot
+ 1.0.0
+
+ druid-spring-boot-samples
+ ${project.artifactId}
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ RELEASE
+
+
+ com.github.drtrang
+ druid-spring-boot-starter
+ ${project.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ com.h2database
+ h2
+
+
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/main/java/com/github/trang/druid/DruidSpringBootStarterApplication.java b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/DruidSpringBootStarterApplication.java
new file mode 100644
index 0000000..330029f
--- /dev/null
+++ b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/DruidSpringBootStarterApplication.java
@@ -0,0 +1,33 @@
+package com.github.trang.druid;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.github.trang.druid.mapper.CityMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * DruidSpringBootStarterApplication
+ *
+ * @author trang
+ */
+@SpringBootApplication
+public class DruidSpringBootStarterApplication implements CommandLineRunner {
+
+ public static void main(String[] args) {
+ System.setProperty("druid.logType", "slf4j");
+ SpringApplication.run(DruidSpringBootStarterApplication.class, args);
+ }
+
+ @Autowired
+ private DruidDataSource dataSource;
+ @Autowired
+ private CityMapper cityMapper;
+
+ @Override
+ public void run(String... args) throws Exception {
+ System.out.println(cityMapper.findByState("CA"));
+ }
+
+}
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/main/java/com/github/trang/druid/mapper/CityMapper.java b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/mapper/CityMapper.java
new file mode 100644
index 0000000..33b9504
--- /dev/null
+++ b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/mapper/CityMapper.java
@@ -0,0 +1,19 @@
+package com.github.trang.druid.mapper;
+
+import com.github.trang.druid.model.City;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * CityMapper
+ *
+ * @author trang
+ */
+@Mapper
+public interface CityMapper {
+
+ @Select("select * from city where state = #{state}")
+ City findByState(@Param("state") String state);
+
+}
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/main/java/com/github/trang/druid/model/City.java b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/model/City.java
new file mode 100644
index 0000000..f931029
--- /dev/null
+++ b/druid-spring-boot-samples/src/main/java/com/github/trang/druid/model/City.java
@@ -0,0 +1,59 @@
+package com.github.trang.druid.model;
+
+import java.io.Serializable;
+
+/**
+ * City
+ *
+ * @author trang
+ */
+public class City implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+
+ private String name;
+
+ private String state;
+
+ private String country;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getState() {
+ return this.state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getCountry() {
+ return this.country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @Override
+ public String toString() {
+ return getId() + "," + getName() + "," + getState() + "," + getCountry();
+ }
+
+}
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/main/resources/application.yml b/druid-spring-boot-samples/src/main/resources/application.yml
new file mode 100644
index 0000000..2ed0b2a
--- /dev/null
+++ b/druid-spring-boot-samples/src/main/resources/application.yml
@@ -0,0 +1,66 @@
+debug: false
+
+logging:
+ level:
+ root: info
+ org.springframework: info
+ org.springframework.jdbc: info
+ com.github.trang: debug
+ com.alibaba.druid.pool.DruidDataSourceStatLoggerImpl: debug
+
+spring:
+ datasource:
+ driver-class-name: org.h2.Driver
+ url: jdbc:h2:file:./samples
+ username: root
+ password: root
+ druid:
+ initial-size: 1
+ min-idle: 1
+ max-active: 10
+ max-wait: 30000
+ time-between-eviction-runs-millis: 60000
+ min-evictable-idle-time-millis: 300000
+ validation-query: SELECT 1
+ test-while-idle: true
+ test-on-borrow: false
+ test-on-return: false
+ pool-prepared-statements: true
+ max-open-prepared-statements: 20
+ use-global-data-source-stat: true
+ stat:
+ db-type: h2
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ slf4j:
+ enabled: true
+ connection-log-enabled: false
+ connection-log-error-enabled: true
+ statement-log-enabled: false
+ statement-log-error-enabled: true
+ statement-sql-pretty-format: true
+ statement-executable-sql-log-enable: true
+ result-set-log-enabled: false
+ result-set-log-error-enabled: true
+ wall:
+ enabled: true
+ db-type: h2
+ log-violation: true
+ throw-exception: false
+ aop:
+ enabled: true
+ patterns:
+ - com.github.trang.mapper.*
+ web:
+ web-stat-filter:
+ enabled: true
+ stat-view-servlet:
+ enabled: true
+ schema: classpath:import.sql
+ aop:
+ auto: true
+ proxy-target-class: true
+
+mybatis:
+ type-aliases-package: com.github.trang.druid.model
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/main/resources/import.sql b/druid-spring-boot-samples/src/main/resources/import.sql
new file mode 100644
index 0000000..8c7c7d6
--- /dev/null
+++ b/druid-spring-boot-samples/src/main/resources/import.sql
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS city;
+
+CREATE TABLE city (
+ id INT(6) PRIMARY KEY AUTO_INCREMENT,
+ NAME VARCHAR(64),
+ state VARCHAR(32),
+ country VARCHAR(32)
+);
+
+INSERT INTO city (NAME, state, country) VALUES ('San Francisco', 'CA', 'US');
\ No newline at end of file
diff --git a/druid-spring-boot-samples/src/test/java/com/github/trang/druid/test/DruidTests.java b/druid-spring-boot-samples/src/test/java/com/github/trang/druid/test/DruidTests.java
new file mode 100644
index 0000000..c2c7a38
--- /dev/null
+++ b/druid-spring-boot-samples/src/test/java/com/github/trang/druid/test/DruidTests.java
@@ -0,0 +1,39 @@
+package com.github.trang.druid.test;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author trang
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.NONE)
+public class DruidTests {
+
+ @Autowired
+ private DruidDataSource dataSource;
+
+ @Test
+ public void testDataSource() {
+ assertEquals(dataSource.getInitialSize(), 1);
+ assertEquals(dataSource.getMinIdle(), 1);
+ assertEquals(dataSource.getMaxActive(), 10);
+ assertEquals(dataSource.getMaxWait(), 30000);
+ assertEquals(dataSource.getTimeBetweenEvictionRunsMillis(), 60000);
+ assertEquals(dataSource.getMinEvictableIdleTimeMillis(), 300000);
+ assertEquals(dataSource.getValidationQuery(), "SELECT 1");
+ assertEquals(dataSource.isTestWhileIdle(), true);
+ assertEquals(dataSource.isTestOnBorrow(), false);
+ assertEquals(dataSource.isTestOnReturn(), false);
+ assertEquals(dataSource.getMaxPoolPreparedStatementPerConnectionSize(), 20);
+ assertEquals(dataSource.isUseGlobalDataSourceStat(), true);
+ }
+
+}
diff --git a/druid-spring-boot-starter-test/pom.xml b/druid-spring-boot-starter-test/pom.xml
deleted file mode 100644
index 8991d1e..0000000
--- a/druid-spring-boot-starter-test/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- druid-spring-boot
- com.github.drtrang
- 1.0.0
-
- 4.0.0
-
- druid-spring-boot-starter-test
-
-
-
\ No newline at end of file
diff --git a/druid-spring-boot-starter/pom.xml b/druid-spring-boot-starter/pom.xml
index b9730b5..4b0d299 100644
--- a/druid-spring-boot-starter/pom.xml
+++ b/druid-spring-boot-starter/pom.xml
@@ -11,7 +11,7 @@
druid-spring-boot-starter
- druid-spring-boot-starter
+ ${project.artifactId}
diff --git a/druid-spring-boot-starter/src/main/resources/META-INF/spring.provides b/druid-spring-boot-starter/src/main/resources/META-INF/spring.provides
index c3f1958..e0f15b3 100644
--- a/druid-spring-boot-starter/src/main/resources/META-INF/spring.provides
+++ b/druid-spring-boot-starter/src/main/resources/META-INF/spring.provides
@@ -1 +1 @@
-provides: spring-boot,spring-boot-configuration-processor,druid,druid-spring-boot-autoconfigure
\ No newline at end of file
+provides: spring-boot-autoconfigure,spring-boot-configuration-processor,druid,druid-spring-boot-autoconfigure
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 1d42cb7..5f37f4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
1.0.0
pom
- druid-spring-boot
+ ${project.artifactId}
Spring Boot Druid Starter
https://github.com/drtrang/druid-spring-boot