Mybatis-Plus配置Oracle和MySQL
短信预约 -IT技能 免费直播动态提醒
准备工作
1、导包
<dependencies> <dependency> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-starter-webartifactId> dependency> <dependency> <groupId>com.baomidougroupId> <artifactId>mybatis-plus-boot-starterartifactId> <version>3.5.1version> dependency> <dependency> <groupId>org.mybatis.spring.bootgroupId> <artifactId>mybatis-spring-boot-starterartifactId> <version>2.2.2version> dependency> <dependency> <groupId>com.alibabagroupId> <artifactId>druid-spring-boot-starterartifactId> <version>1.2.16version> dependency> <dependency> <groupId>com.alibabagroupId> <artifactId>druid-spring-boot-starterartifactId> <version>1.2.11version> dependency> <dependency> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-starter-jdbcartifactId> dependency> <dependency> <groupId>mysqlgroupId> <artifactId>mysql-connector-javaartifactId> <scope>runtimescope> dependency> <dependency> <groupId>com.baomidougroupId> <artifactId>mybatis-plus-generatorartifactId> <version>3.5.2version> dependency> <dependency> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-starter-freemarkerartifactId> dependency> <dependency> <groupId>org.projectlombokgroupId> <artifactId>lombokartifactId> <optional>trueoptional> dependency> <dependency> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-starter-testartifactId> <scope>testscope> dependency> dependencies> <build> <resources> <resource> <directory>class="lazy" data-src/main/javadirectory> <includes> <include>***.xmlinclude> includes> <filtering>falsefiltering> resource> <resource> <directory>class="lazy" data-src/main/resourcesdirectory> <includes> <include>***.xmlinclude> includes> <filtering>falsefiltering> resource> resources> <plugins> <plugin> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-maven-pluginartifactId> <configuration> <excludes> <exclude><groupId>org.projectlombokgroupId><artifactId>lombokartifactId> exclude> excludes> configuration> plugin> plugins> <plugins> <plugin> <groupId>org.springframework.bootgroupId> <artifactId>spring-boot-maven-pluginartifactId> <executions> <execution> <goals><goal>repackagegoal> goals> execution> executions> plugin> plugins> <finalName>项目名finalName> build>
2、全部的配置文件(配置JDBC、Druid、MP)
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver username: root password: 123456 url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true&allowMultiQueries=true # Oracle配置 #url: jdbc:oracle:thin:@127.0.0.1:1521:test #username: root #password: 123456 #driver-class-name: oracle.jdbc.driver.OracleDriver # 配置druid数据源 type: com.alibaba.druid.pool.DruidDataSource # druid 配置 druid: # 打开我们的内置监控页面,打开后我们才可以有相应的web界面 stat-view-servlet: enabled: true url-pattern: /druid*.propertiesinclude> <include>***.propertiesinclude> <include>**/*.xmlinclude> includes> <filtering>falsefiltering> resource> resources>build>
来源地址:https://blog.csdn.net/qq_57581439/article/details/130767476
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341