最近有一个新项目需要开发搭建了个SpringBoot框架 记录一下!
Oracle连接jar编译到maven仓库参考:Maven编译jar包到本地仓库
1、SpringBoot版本:
2.1.6.RELEASE
2、pom配置
<!-- jdbc配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <!-- web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- druid连接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.10</version> </dependency> <!-- Oracle 驱动包 自行下载编译到maven仓库 --> <dependency> <groupId>org.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.2.0</version> </dependency> <!-- Mybatis配置 --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.0.1</version> </dependency> <!-- AOP配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <!-- log4j日志配置 --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>
3、Druid配置
Druid配置类
package com.jst.tjgx.supervisionservice.datasource; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support.http.WebStatFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springfram
SpringBoot+Druid+Mybatis连接Oracle
最新推荐文章于 2024-09-17 11:32:07 发布
本文记录了一次使用SpringBoot 2.1.6.RELEASE框架,结合Druid数据源和Mybatis连接Oracle数据库的过程。详细介绍了pom配置、Druid配置类的编写以及在application.properties中配置Druid和Mybatis的步骤。完成配置后,可通过http://localhost:8080/druid进行监控,账号密码默认为admin。
摘要由CSDN通过智能技术生成