diff --git a/druid-spring-boot-starter/src/main/resources/META-INF/spring.factories b/druid-spring-boot-starter/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 9686c32427..0000000000 --- a/druid-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourcePropertiesAutoConfigure \ No newline at end of file diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/dao/UserDao.java b/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/dao/UserDao.java deleted file mode 100644 index 9a7d2aa02d..0000000000 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/dao/UserDao.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test.dao; - -import com.alibaba.druid.spring.boot.autoconfigure.test.model.User; -import org.springframework.data.repository.CrudRepository; - -public interface UserDao extends CrudRepository {} - diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserService.java b/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserService.java deleted file mode 100644 index 2bbfb2f671..0000000000 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test.service; - -import com.alibaba.druid.spring.boot.autoconfigure.test.model.User; - -public interface UserService { - User findById(Long id); -} diff --git a/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.java new file mode 100644 index 0000000000..e1927fbe1b --- /dev/null +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.java @@ -0,0 +1,60 @@ +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; + +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.env.Environment; + +import javax.sql.DataSource; + +/** + * The Druid data source auto configure. + * + * @author lihengming<89921218@qq.com> + */ +@Configuration +@ConditionalOnClass(com.alibaba.druid.pool.DruidDataSource.class) +@EnableConfigurationProperties(DruidStatProperties.class) +@Import({DruidSpringAopConfiguration.class, DruidStatViewServletConfiguration.class, DruidStatFilterConfiguration.class}) +public class DruidDataSourceAutoConfigure { + + @Bean + @ConfigurationProperties("spring.datasource.druid") + public DataSource dataSource(Environment env) { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + + //if not found prefix spring.datasource.druid property,spring.datasource prefix property will be used + if (dataSource.getUsername() == null) { + dataSource.setUsername(env.getProperty("spring.datasource.username")); + } + if (dataSource.getPassword() == null) { + dataSource.setPassword(env.getProperty("spring.datasource.password")); + } + if (dataSource.getUrl() == null) { + dataSource.setUrl(env.getProperty("spring.datasource.url")); + } + if (dataSource.getDriverClassName() == null) { + dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); + } + return dataSource; + } +} diff --git a/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceBuilder.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceBuilder.java new file mode 100644 index 0000000000..7b94c6d459 --- /dev/null +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidDataSourceBuilder.java @@ -0,0 +1,64 @@ +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; + + +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.boot.bind.RelaxedDataBinder; +import org.springframework.boot.jdbc.DatabaseDriver; + +import java.util.HashMap; +import java.util.Map; + +/** + * The Druid data source builder. + * + * @author lihengming<89921218@qq.com> + */ +public class DruidDataSourceBuilder { + + private Map properties = new HashMap(); + + public static DruidDataSourceBuilder create() { + return new DruidDataSourceBuilder(); + } + + public DruidDataSource build() { + DruidDataSource dataSource = new DruidDataSource(); + maybeGetDriverClassName(); + bind(dataSource); + return dataSource; + } + + //use RelaxedDataBinder by reflection config druid . + private void bind(DruidDataSource result) { + MutablePropertyValues properties = new MutablePropertyValues(this.properties); + new RelaxedDataBinder(result) + .withAlias("url", "jdbcUrl") + .withAlias("username", "user") + .bind(properties); + } + + private void maybeGetDriverClassName() { + if (!this.properties.containsKey("driverClassName") + && this.properties.containsKey("url")) { + String url = this.properties.get("url"); + String driverClass = DatabaseDriver.fromJdbcUrl(url).getDriverClassName(); + this.properties.put("driverClassName", driverClass); + } + } +} diff --git a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidSpringAopConfiguration.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidSpringAopConfiguration.java similarity index 64% rename from druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidSpringAopConfiguration.java rename to src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidSpringAopConfiguration.java index 2ac9a9abe2..98ac4e7545 100644 --- a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidSpringAopConfiguration.java +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidSpringAopConfiguration.java @@ -1,4 +1,19 @@ -package com.alibaba.druid.spring.boot.autoconfigure; +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; import org.aopalliance.aop.Advice; @@ -12,7 +27,7 @@ import org.springframework.context.annotation.Bean; /** * The Druid spring aop configuration. * - * @author lihengming< qq.com> + * @author lihengming<89921218@qq.com> * @see Druid和Spring关联监控配置 */ @ConditionalOnProperty("spring.datasource.druid.aop-patterns") @@ -26,7 +41,7 @@ public class DruidSpringAopConfiguration { } @Bean - public Advisor advisor(DruidProperties properties) { + public Advisor advisor(DruidStatProperties properties) { return new RegexpMethodPointcutAdvisor(properties.getAopPatterns(), advice()); } diff --git a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatFilterConfiguration.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatFilterConfiguration.java similarity index 63% rename from druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatFilterConfiguration.java rename to src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatFilterConfiguration.java index 295c4a6f69..16fa73a108 100644 --- a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatFilterConfiguration.java +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatFilterConfiguration.java @@ -1,4 +1,19 @@ -package com.alibaba.druid.spring.boot.autoconfigure; +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; import com.alibaba.druid.support.http.WebStatFilter; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -8,14 +23,14 @@ import org.springframework.context.annotation.Bean; /** * The Druid stat filter configuration. * - * @author lihengming< qq.com> + * @author lihengming<89921218@qq.com> * @see 配置WebStatFilter */ -@ConditionalOnProperty(name = "spring.datasource.druid.StatFilter.enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(name = "spring.datasource.druid.stat.StatFilter.enabled", havingValue = "true", matchIfMissing = true) public class DruidStatFilterConfiguration { @Bean - public FilterRegistrationBean filterRegistrationBean(DruidProperties properties) { - DruidProperties.StatFilter config = properties.getStatFilter(); + public FilterRegistrationBean filterRegistrationBean(DruidStatProperties properties) { + DruidStatProperties.StatFilter config = properties.getStatFilter(); FilterRegistrationBean registrationBean = new FilterRegistrationBean(); WebStatFilter filter = new WebStatFilter(); registrationBean.setFilter(filter); diff --git a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidProperties.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatProperties.java similarity index 55% rename from druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidProperties.java rename to src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatProperties.java index 2acdc359bb..3e050c4af3 100644 --- a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidProperties.java +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatProperties.java @@ -1,135 +1,34 @@ -package com.alibaba.druid.spring.boot.autoconfigure; +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; import org.springframework.boot.context.properties.ConfigurationProperties; /** + * The type Druid stat properties. + * * @author lihengming<89921218@qq.com> - * @see DruidDataSource参考配置 */ @ConfigurationProperties("spring.datasource.druid") -public class DruidProperties{ - private Integer initialSize; - private Integer minIdle; - private Integer maxActive; - private Integer maxWait; - private Integer timeBetweenEvictionRunsMillis; - private Integer minEvictableIdleTimeMillis; - private String validationQuery; - private Boolean testOnBorrow; - private Boolean testOnReturn; - private Boolean testWhileIdle; - private String filters; - private Boolean poolPreparedStatements; - private Integer maxPoolPreparedStatementPerConnectionSize; +public class DruidStatProperties { private String[] aopPatterns; private StatViewServlet statViewServlet = new StatViewServlet(); private StatFilter statFilter = new StatFilter(); - public Integer getInitialSize() { - return initialSize; - } - - public void setInitialSize(Integer initialSize) { - this.initialSize = initialSize; - } - - public Integer getMinIdle() { - return minIdle; - } - - public void setMinIdle(Integer minIdle) { - this.minIdle = minIdle; - } - - public Integer getMaxActive() { - return maxActive; - } - - public void setMaxActive(Integer maxActive) { - this.maxActive = maxActive; - } - - public Integer getMaxWait() { - return maxWait; - } - - public void setMaxWait(Integer maxWait) { - this.maxWait = maxWait; - } - - public String getValidationQuery() { - return validationQuery; - } - - public void setValidationQuery(String validationQuery) { - this.validationQuery = validationQuery; - } - - public Boolean getTestOnBorrow() { - return testOnBorrow; - } - - public void setTestOnBorrow(Boolean testOnBorrow) { - this.testOnBorrow = testOnBorrow; - } - - public Boolean getTestOnReturn() { - return testOnReturn; - } - - public void setTestOnReturn(Boolean testOnReturn) { - this.testOnReturn = testOnReturn; - } - - public Boolean getTestWhileIdle() { - return testWhileIdle; - } - - public void setTestWhileIdle(Boolean testWhileIdle) { - this.testWhileIdle = testWhileIdle; - } - - public Integer getTimeBetweenEvictionRunsMillis() { - return timeBetweenEvictionRunsMillis; - } - - public void setTimeBetweenEvictionRunsMillis(Integer timeBetweenEvictionRunsMillis) { - this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; - } - - public Integer getMinEvictableIdleTimeMillis() { - return minEvictableIdleTimeMillis; - } - - public void setMinEvictableIdleTimeMillis(Integer minEvictableIdleTimeMillis) { - this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; - } - - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } - - public Boolean getPoolPreparedStatements() { - return poolPreparedStatements; - } - - public void setPoolPreparedStatements(Boolean poolPreparedStatements) { - this.poolPreparedStatements = poolPreparedStatements; - } - - public Integer getMaxPoolPreparedStatementPerConnectionSize() { - return maxPoolPreparedStatementPerConnectionSize; - } - - public void setMaxPoolPreparedStatementPerConnectionSize(Integer maxPoolPreparedStatementPerConnectionSize) { - this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize; - } - public String[] getAopPatterns() { return aopPatterns; } @@ -157,7 +56,7 @@ public class DruidProperties{ /** * @see StatViewServlet配置 */ - public static class StatViewServlet{ + public static class StatViewServlet { private String urlPattern; private String allow; private String deny; @@ -217,7 +116,7 @@ public class DruidProperties{ /** * @see 配置WebStatFilter */ - public static class StatFilter{ + public static class StatFilter { private String urlPattern; private String exclusions; private String sessionStatMaxCount; diff --git a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java similarity index 66% rename from druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java rename to src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java index 427b5b440a..bfb60b8d03 100644 --- a/druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java +++ b/src/main/java/com/alibaba/druid/support/spring/boot/autoconfigure/DruidStatViewServletConfiguration.java @@ -1,4 +1,19 @@ -package com.alibaba.druid.spring.boot.autoconfigure; +/* + * Copyright 1999-2017 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.druid.support.spring.boot.autoconfigure; import com.alibaba.druid.support.http.StatViewServlet; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -8,14 +23,14 @@ import org.springframework.context.annotation.Bean; /** * The Druid stat view servlet configuration. * - * @author lihengming< qq.com> + * @author lihengming<89921218@qq.com> * @see StatViewServlet配置 */ @ConditionalOnProperty(name = "spring.datasource.druid.StatViewServlet.enabled", havingValue = "true", matchIfMissing = true) public class DruidStatViewServletConfiguration { @Bean - public ServletRegistrationBean servletRegistrationBean(DruidProperties properties) { - DruidProperties.StatViewServlet config = properties.getStatViewServlet(); + public ServletRegistrationBean servletRegistrationBean(DruidStatProperties properties) { + DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); ServletRegistrationBean registration = new ServletRegistrationBean(); registration.setServlet(new StatViewServlet()); registration.addUrlMappings(config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"); diff --git a/src/main/resources/META-INF/spring.factories b/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000..11bd1b66cc --- /dev/null +++ b/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.alibaba.druid.support.spring.boot.autoconfigure.DruidDataSourceAutoConfigure \ No newline at end of file diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/Application.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/Application.java similarity index 81% rename from druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/Application.java rename to src/test/java/com/alibaba/druid/spring/boot/autoconfigure/Application.java index b37fe32a60..e066baf254 100644 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/Application.java +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/Application.java @@ -1,4 +1,4 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test; +package com.alibaba.druid.spring.boot.autoconfigure; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @author lihengming<89921218@qq.com> * *

druid-spring-boot-starter 测试例子

- *

1.按需配置application.properties

+ *

1.按需配置application.properties,配置项请参考

*

2.run Application

*

3.访问http://127.0.0.1:8080/druid

*

4.访问/user/{id}接口,查看监控效果,如:http://127.0.0.1:8080/user/1

diff --git a/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/dao/UserDao.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/dao/UserDao.java new file mode 100644 index 0000000000..965e27f376 --- /dev/null +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/dao/UserDao.java @@ -0,0 +1,8 @@ +package com.alibaba.druid.spring.boot.autoconfigure.dao; + + +import com.alibaba.druid.spring.boot.autoconfigure.model.User; +import org.springframework.data.repository.CrudRepository; + +public interface UserDao extends CrudRepository {} + diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/model/User.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/model/User.java similarity index 92% rename from druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/model/User.java rename to src/test/java/com/alibaba/druid/spring/boot/autoconfigure/model/User.java index 90954b2843..4d3fc16c92 100644 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/model/User.java +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/model/User.java @@ -1,4 +1,4 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test.model; +package com.alibaba.druid.spring.boot.autoconfigure.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserService.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserService.java new file mode 100644 index 0000000000..da12cd6f6b --- /dev/null +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserService.java @@ -0,0 +1,8 @@ +package com.alibaba.druid.spring.boot.autoconfigure.service; + + +import com.alibaba.druid.spring.boot.autoconfigure.model.User; + +public interface UserService { + User findById(Long id); +} diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserServiceImpl.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserServiceImpl.java similarity index 73% rename from druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserServiceImpl.java rename to src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserServiceImpl.java index 2e5828b87c..a8bf4b9108 100644 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/service/UserServiceImpl.java +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/service/UserServiceImpl.java @@ -1,7 +1,7 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test.service; +package com.alibaba.druid.spring.boot.autoconfigure.service; -import com.alibaba.druid.spring.boot.autoconfigure.test.dao.UserDao; -import com.alibaba.druid.spring.boot.autoconfigure.test.model.User; +import com.alibaba.druid.spring.boot.autoconfigure.dao.UserDao; +import com.alibaba.druid.spring.boot.autoconfigure.model.User; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/web/UserController.java b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/web/UserController.java similarity index 69% rename from druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/web/UserController.java rename to src/test/java/com/alibaba/druid/spring/boot/autoconfigure/web/UserController.java index 7ec6105d11..ce54065c45 100644 --- a/druid-spring-boot-starter/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/test/web/UserController.java +++ b/src/test/java/com/alibaba/druid/spring/boot/autoconfigure/web/UserController.java @@ -1,7 +1,7 @@ -package com.alibaba.druid.spring.boot.autoconfigure.test.web; +package com.alibaba.druid.spring.boot.autoconfigure.web; -import com.alibaba.druid.spring.boot.autoconfigure.test.service.UserService; -import com.alibaba.druid.spring.boot.autoconfigure.test.model.User; +import com.alibaba.druid.spring.boot.autoconfigure.model.User; +import com.alibaba.druid.spring.boot.autoconfigure.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping;