Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能够提供完整的2.0下文档 #15

Open
Lswx2017 opened this issue Apr 24, 2018 · 1 comment
Open

希望能够提供完整的2.0下文档 #15

Lswx2017 opened this issue Apr 24, 2018 · 1 comment

Comments

@Lswx2017
Copy link

spring boot 从1到2 升级变化挺大,不同版本之间的兼容性也容易出问题,配置文件,引用包不同,都可能出现各种问题。

如果能够提供完整的2.0下的用法,同时理清跟官网的关系就更好了。持续关注中。

@drtrang
Copy link
Owner

drtrang commented Jun 4, 2018

@Lswx2017 sorry,之前看到忘记回复了。

对于本项目来说,使用 spring boot 1.x 和 2.x 完全没有任何区别,各项配置均通用。我在具体实现中屏蔽了 spring boot 版本的区别,对用户暴露的功能是一致的,并且配置方式也是相同的。

用户需要做的仅仅是根据你使用的 spring boot 版本来选择需要引入的 jar 包,两个版本的 Maven 坐标分别如下:

<!-- spring boot 1.x -->
<dependency>
    <groupId>com.github.drtrang</groupId>
    <artifactId>druid-spring-boot-starter</artifactId>
    <version>1.1.10</version>
</dependency>

<!-- spring boot 2.x -->
<dependency>
    <groupId>com.github.drtrang</groupId>
    <artifactId>druid-spring-boot2-starter</artifactId>
    <version>1.1.10</version>
</dependency>

在本项目中有两个分支来分别实现对 spring boot 两个版本的支持,master 分支基于 spring boot 1.x,boot2 分支基于 spring boot 2.x,如果有兴趣可以通过切换分支来查看源码。

在各自分支内的 example 都是可用的,也就是说,如果你用的 spring boot 2.x,那么可以参考下 boot2 分支下的代码示例:druid-spring-boot-mybatis-example

至于和官方 starter 的关系,只是拥有同样目的的两个轮子而已,各有所长,你觉得哪个顺手可以选择哪个。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants