springBoot整合数据库环境搭建
精简版:
1、整合 mybatis + mysql
-
导入相关依赖(mybatis ,mysql驱动,pageHelper分页插件)
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
-
配置yml 文件 spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.trkj.boot_mybatis.entity
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countS
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
-
写实体类 -
写接口 与 mapper映射文件 @Mapper
public interface DeptDao{
List<Dept> findAllByLimit();
}
-
写service 分页
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAllByLimit();
}
-
写controller
2、整合 mybatis + oracle
-
导入相关依赖(mybatis ,mysql驱动,pageHelper分页插件)
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.8</version>
</dependency>
<dependency>
<groupId>cn.easyproject</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
-
配置yml 文件 spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
mybatis:
type-aliases-package: com.trkj.boot_mybatis_oracle.entity
mapper-locations: classpath:mapper/*.xml
pagehelper:
helperDialect: oracle
reasonable: true
supportMethodsArguments: true
params: count=countS
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
-
写实体类 -
写接口 与 mapper映射文件 @Mapper
public interface DeptDao{
List<Dept> findAllByLimit();
}
-
写service 分页
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAllByLimit();
}
-
写controller
3、整合 jpa+ mysql
-
导入mysql 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
-
yml配置文件 spring:
jpa:
database: MYSQL
database-platform: org.hibernate.dialect.MySQL8Dialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
实体类 根据 persistence生成 3编写接口 DeptDao.java public interface DeptDao extends CrudRepository<DeptEntity,Integer> {
List<DeptEntity> findAll(Pageable pageable);
}
4编写service DeptService.java
public List<DeptEntity> findAll(int page,int size){
Pageable pageable = PageRequest.of(page,size);
return deptDao.findAll(pageable);
}
4、整合 jpa+ oracle
-
导入mysql 依赖
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>cn.easyproject</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
-
yml配置文件 spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
jpa:
database: oracle
database-platform: org.hibernate.dialect.OracleDialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
5、整合 mybatis + mysql + Druid
同上 mybatis + mysql
不同:修改yaml配置文件
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/mybatis?useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=GMT%2B8
username: TR
password: adminxhb
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
type-aliases-package: com.trkj.bootmybatis.pojo
mapper-locations: classpath:mapper/*.xml
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
Druid 数据源配置类
package com.trkj.boot_mybatis_mysql_druid.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
public class DruidConfig {
@Autowired
private DataSourceProperties dataSourceProperties;
@Bean
public DruidDataSource druidDataSource(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(dataSourceProperties.getUrl());
druidDataSource.setUsername(dataSourceProperties.getUsername());
druidDataSource.setPassword(dataSourceProperties.getPassword());
druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName());
druidDataSource.setInitialSize(0);
druidDataSource.setMaxActive(180);
druidDataSource.setMaxWait(60000);
druidDataSource.setMinIdle(0);
druidDataSource.setValidationQuery("Select 1 from DUAL");
druidDataSource.setTestOnBorrow(false);
druidDataSource.setTestOnReturn(false);
druidDataSource.setTestWhileIdle(true);
druidDataSource.setTimeBetweenEvictionRunsMillis(60000);
druidDataSource.setMinEvictableIdleTimeMillis(180000);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(1800);
druidDataSource.setLogAbandoned(true);
try {
druidDataSource.setFilters("stat,wall,stat,log4j2");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return druidDataSource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root2020");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,");
return filterRegistrationBean;
}
}
6、整合 mybatis + oracle+ Druid
yml 配置
server:
port: 8899
servlet:
context-path: /boot_mybatis_oracle_druid
spring:
datasource:
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
driver-class-name: oracle.jdbc.driver.OracleDriver
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
type-aliases-package: com.trkj.bootmybatis.pojo
mapper-locations: classpath:mapper/*.xml
数据源配置文件同 精简版mybatis+mysql+Druid
7、整合 jpa + mysql + Druid
yaml配置
spring:
jpa:
database: MYSQL
database-platform: org.hibernate.dialect.MySQL8Dialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
type: com.alibaba.druid.pool.DruidDataSource
server:
port: 8899
servlet:
context-path: /boot_jpa_mysql
数据源配置文件同 精简版mybatis+mysql+Druid
8、整合 jpa + oracle + Druid
yml配置文件
spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
type: com.alibaba.druid.pool.DruidDataSource
jpa:
database: oracle
database-platform: org.hibernate.dialect.OracleDialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
数据源配置文件同 精简版mybatis+mysql+Druid
傻瓜版:
1、整合 mybatis + mysql
-
导入 mybatis 、mysql 、pagehelper的依赖 <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
配置yml 文件 spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
server:
port: 8899
servlet:
context-path: /boot_mybatis
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.trkj.boot_mybatis.entity
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countS
tips:classpath:代表的是resource 目录 :resource/mapper/*.xml -
编写实体类 Dept.java @Data
@ToString
public class Dept {
private int deptno;
private String dname;
private String loc;
}
-
编写接口 与 mapper 映射文件 编写接口:DeptDao.java @Mapper
public interface DeptDao{
Dept findDeptById(int deptno);
List<Dept> findAllByLimit();
}
编写mapper映射文件 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.trkj.boot_mybatis.dao.DeptDao">
<select id="findDeptById" resultType="com.trkj.boot_mybatis.entity.Dept">
select * from dept where deptno = #{deptno}
</select>
<select id="findAllByLimit" resultType="com.trkj.boot_mybatis.entity.Dept">
select * from dept
</select>
</mapper>
-
编写service :DeptService.java package com.trkj.boot_mybatis.service;
import com.github.pagehelper.PageHelper;
import com.trkj.boot_mybatis.dao.DeptDao;
import com.trkj.boot_mybatis.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public Dept findDeptById(int deptno){
return deptDao.findDeptById(deptno);
}
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAllByLimit();
}
}
-
编写controller DeptController.java package com.trkj.boot_mybatis.controller;
import com.github.pagehelper.PageHelper;
import com.trkj.boot_mybatis.entity.Dept;
import com.trkj.boot_mybatis.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public Dept findDept(@PathVariable("deptno") int deptno){
Dept dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<Dept> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<Dept> list = deptService.findAll(page,size);
return list;
}
}
2、整合 mybatis + oracle
-
导入Oracle依赖 <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.8</version>
</dependency>
<dependency>
<groupId>cn.easyproject</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
yml配置文件 spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
mybatis:
type-aliases-package: com.trkj.boot_mybatis_oracle.entity
mapper-locations: classpath:mapper/*.xml
server:
port: 8899
servlet:
context-path: /boot_mybatis_oracle
pagehelper:
helperDialect: oracle
reasonable: true
supportMethodsArguments: true
params: count=countS
-
编写实体类 Dept.java @Data
@ToString
public class Dept {
private int deptno;
private String dname;
private String loc;
}
-
编写接口 与 mapper映射文件 编写接口: import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DeptDao {
Dept findDeptById(int deptno);
List<Dept> findAll();
}
编写mapper映射 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.trkj.boot_mybatis_oracle.dao.DeptDao">
<select id="findDeptById" resultType="com.trkj.boot_mybatis_oracle.entity.Dept">
select * from DEPT where DEPTNO = #{deptno}
</select>
<select id="findAll" resultType="com.trkj.boot_mybatis_oracle.entity.Dept">
select * from DEPT
</select>
</mapper>
-
编写service DeptService.java @Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public Dept findDeptById(int deptno){
return deptDao.findDeptById(deptno);
}
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAll();
}
}
-
编写controller DeptController.java @RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public Dept findDept(@PathVariable("deptno") int deptno){
Dept dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<Dept> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<Dept> list = deptService.findAll(page,size);
return list;
}
}
// todo : 分页效果没出来
3、整合 jpa+ mysql
-
导入mysql 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
yml配置文件 spring:
jpa:
database: MYSQL
database-platform: org.hibernate.dialect.MySQL8Dialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
server:
port: 8899
servlet:
context-path: /boot_jpa_mysql
-
编写实体类 DeptEntity.java persistence自动生成的 @Entity
@Table(name = "dept", schema = "yf03203", catalog = "")
public class DeptEntity {
private Integer deptno;
private String dname;
private String loc;
@Id
@Column(name = "deptno")
public Integer getDeptno() {
return deptno;
}
public void setDeptno(Integer deptno) {
this.deptno = deptno;
}
@Basic
@Column(name = "dname")
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
@Basic
@Column(name = "loc")
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
}
-
编写接口 DeptDao.java import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
public interface DeptDao extends CrudRepository<DeptEntity,Integer> {
List<DeptEntity> findAll(Pageable pageable);
}
-
编写service DeptService.java @Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public DeptEntity findDeptById(int deptno){
return deptDao.findById(deptno).orElse(null);
}
public List<DeptEntity> findAll(int page,int size){
Pageable pageable = PageRequest.of(page,size);
return deptDao.findAll(pageable);
}
}
-
编写controller DeptController.java @RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public DeptEntity findDept(@PathVariable("deptno") int deptno){
DeptEntity dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<DeptEntity> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<DeptEntity> list = deptService.findAll(page,size);
return list;
}
}
4、整合 jpa+ oracle
-
导入mysql 依赖
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>cn.easyproject</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
yml配置文件 spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
jpa:
database: oracle
database-platform: org.hibernate.dialect.OracleDialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
-
编写实体类 DeptEntity.java persistence自动生成的 @Entity
@Table(name = "DEPT", schema = "SCOTT", catalog = "")
public class DeptEntity {
private long deptno;
private String dname;
private String loc;
@Id
@Column(name = "DEPTNO")
public long getDeptno() {
return deptno;
}
public void setDeptno(long deptno) {
this.deptno = deptno;
}
@Basic
@Column(name = "DNAME")
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
@Basic
@Column(name = "LOC")
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
}
-
编写接口 DeptDao.java import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
public interface DeptDao extends CrudRepository<DeptEntity,Long> {
List<DeptEntity> findAll(Pageable pageable);
}
-
编写service DeptService.java @Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public DeptEntity findDeptById(long deptno){
return deptDao.findById(deptno).orElse(null);
}
public List<DeptEntity> findAll(int page,int size){
Pageable pageable = PageRequest.of(page,size);
return deptDao.findAll(pageable);
}
}
-
编写controller DeptController.java @RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public DeptEntity findDept(@PathVariable("deptno") int deptno){
DeptEntity dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<DeptEntity> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<DeptEntity> list = deptService.findAll(page,size);
return list;
}
}
5、整合 mybatis + mysql + Druid
-
导入依赖 mybatis-spring,Druid数据源,mysql驱动 ,pageHelper分页插件
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
yml配置文件 spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/mybatis?useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=GMT%2B8
username: TR
password: adminxhb
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
type-aliases-package: com.trkj.bootmybatis.pojo
mapper-locations: classpath:mapper/*.xml
-
编写 Druid 数据源配置类 package com.trkj.boot_mybatis_mysql_druid.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
public class DruidConfig {
@Autowired
private DataSourceProperties dataSourceProperties;
@Bean
public DruidDataSource druidDataSource(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(dataSourceProperties.getUrl());
druidDataSource.setUsername(dataSourceProperties.getUsername());
druidDataSource.setPassword(dataSourceProperties.getPassword());
druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName());
druidDataSource.setInitialSize(0);
druidDataSource.setMaxActive(180);
druidDataSource.setMaxWait(60000);
druidDataSource.setMinIdle(0);
druidDataSource.setValidationQuery("Select 1 from DUAL");
druidDataSource.setTestOnBorrow(false);
druidDataSource.setTestOnReturn(false);
druidDataSource.setTestWhileIdle(true);
druidDataSource.setTimeBetweenEvictionRunsMillis(60000);
druidDataSource.setMinEvictableIdleTimeMillis(180000);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(1800);
druidDataSource.setLogAbandoned(true);
try {
druidDataSource.setFilters("stat,wall,stat,log4j2");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return druidDataSource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root2020");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,");
return filterRegistrationBean;
}
}
-
编写实体类 DeptEntity.java persistence自动生成的 @Data
@ToString
public class Dept {
private int deptno;
private String dname;
private String loc;
}
-
编写接口 与 mapper 映射文件 接口:DeptDao.java @Mapper
public interface DeptDao{
Dept findDeptById(int deptno);
List<Dept> findAllByLimit();
}
编写mapper:DeptMapper.xml <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.trkj.boot_mybatis_mysql_druid.dao.DeptDao">
<select id="findDeptById" resultType="com.trkj.boot_mybatis_mysql_druid.entity.Dept">
select * from dept where deptno = #{deptno}
</select>
<select id="findAllByLimit" resultType="com.trkj.boot_mybatis_mysql_druid.entity.Dept">
select * from dept
</select>
</mapper>
-
编写service DeptService.java @Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public Dept findDeptById(int deptno){
return deptDao.findDeptById(deptno);
}
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAllByLimit();
}
}
-
编写controller DeptController.java @RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public Dept findDept(@PathVariable("deptno") int deptno){
Dept dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<Dept> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<Dept> list = deptService.findAll(page,size);
return list;
}
}
6、整合 mybatis + oracle+ Druid
-
导入依赖 mybatis-spring,Druid数据源,mysql驱动 ,pageHelper分页插件
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>cn.easyproject</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
-
yml配置文件
server:
port: 8899
servlet:
context-path: /boot_mybatis_oracle_druid
spring:
datasource:
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
driver-class-name: oracle.jdbc.driver.OracleDriver
type: com.alibaba.druid.pool.DruidDataSource
mybatis:
type-aliases-package: com.trkj.bootmybatis.pojo
mapper-locations: classpath:mapper/*.xml
-
编写 Druid 数据源配置类 package com.trkj.boot_mybatis_mysql_druid.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
public class DruidConfig {
@Autowired
private DataSourceProperties dataSourceProperties;
@Bean
public DruidDataSource druidDataSource(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(dataSourceProperties.getUrl());
druidDataSource.setUsername(dataSourceProperties.getUsername());
druidDataSource.setPassword(dataSourceProperties.getPassword());
druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName());
druidDataSource.setInitialSize(0);
druidDataSource.setMaxActive(180);
druidDataSource.setMaxWait(60000);
druidDataSource.setMinIdle(0);
druidDataSource.setValidationQuery("Select 1 from DUAL");
druidDataSource.setTestOnBorrow(false);
druidDataSource.setTestOnReturn(false);
druidDataSource.setTestWhileIdle(true);
druidDataSource.setTimeBetweenEvictionRunsMillis(60000);
druidDataSource.setMinEvictableIdleTimeMillis(180000);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(1800);
druidDataSource.setLogAbandoned(true);
try {
druidDataSource.setFilters("stat,wall,stat,log4j2");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return druidDataSource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root2020");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,");
return filterRegistrationBean;
}
}
-
编写实体类 DeptEntity.java persistence自动生成的 @Data
@ToString
public class Dept {
private int deptno;
private String dname;
private String loc;
}
-
编写接口 与 mapper 映射文件 接口:DeptDao.java @Mapper
public interface DeptDao{
Dept findDeptById(int deptno);
List<Dept> findAllByLimit();
}
编写mapper:DeptMapper.xml <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.trkj.boot_mybatis_oracle_druid.dao.DeptDao">
<select id="findDeptById" resultType="com.trkj.boot_mybatis_oracle_druid.entity.Dept">
select * from dept where deptno = #{deptno}
</select>
<select id="findAllByLimit" resultType="com.trkj.boot_mybatis_oracle_druid.entity.Dept">
select * from dept
</select>
</mapper>
-
编写service DeptService.java @Service
public class DeptService {
@Autowired
private DeptDao deptDao;
public Dept findDeptById(int deptno){
return deptDao.findDeptById(deptno);
}
public List<Dept> findAll(int page,int size){
PageHelper.startPage(page,size);
return deptDao.findAllByLimit();
}
}
-
编写controller DeptController.java @RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping("findDept/{deptno}")
public Dept findDept(@PathVariable("deptno") int deptno){
Dept dept = deptService.findDeptById(deptno);
return dept;
}
@RequestMapping("findDepts/{page}/{size}")
public List<Dept> findDepts(@PathVariable("page") int page,@PathVariable("size")int size){
List<Dept> list = deptService.findAll(page,size);
return list;
}
}
7、整合 jpa + mysql + Druid
同 jpa + mysql
需要修改的:
-
yml配置 spring:
jpa:
database: MYSQL
database-platform: org.hibernate.dialect.MySQL8Dialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/yf03203?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&&useSSL=false
username: TR
password: adminxhb
type: com.alibaba.druid.pool.DruidDataSource
server:
port: 8899
servlet:
context-path: /boot_jpa_mysql
-
DruidConfig.java (数据源配置类) package com.trkj.boot_mybatis_mysql_druid.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
public class DruidConfig {
@Autowired
private DataSourceProperties dataSourceProperties;
@Bean
public DruidDataSource druidDataSource(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(dataSourceProperties.getUrl());
druidDataSource.setUsername(dataSourceProperties.getUsername());
druidDataSource.setPassword(dataSourceProperties.getPassword());
druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName());
druidDataSource.setInitialSize(0);
druidDataSource.setMaxActive(180);
druidDataSource.setMaxWait(60000);
druidDataSource.setMinIdle(0);
druidDataSource.setValidationQuery("Select 1 from DUAL");
druidDataSource.setTestOnBorrow(false);
druidDataSource.setTestOnReturn(false);
druidDataSource.setTestWhileIdle(true);
druidDataSource.setTimeBetweenEvictionRunsMillis(60000);
druidDataSource.setMinEvictableIdleTimeMillis(180000);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(1800);
druidDataSource.setLogAbandoned(true);
try {
druidDataSource.setFilters("stat,wall,stat,log4j2");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return druidDataSource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root2020");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,");
return filterRegistrationBean;
}
}
8、整合 jpa + oracle + Druid
yml 配置
spring:
datasource:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
username: scott
password: tiger
type: com.alibaba.druid.pool.DruidDataSource
jpa:
database: oracle
database-platform: org.hibernate.dialect.OracleDialect
show-sql: true
format-sql: true
hibernate:
ddl-auto: none
server:
port: 8899
servlet:
context-path: /boot_jpa_oracle
DruidConfig.java (数据源配置类)
package com.trkj.boot_mybatis_mysql_druid.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
public class DruidConfig {
@Autowired
private DataSourceProperties dataSourceProperties;
@Bean
public DruidDataSource druidDataSource(){
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl(dataSourceProperties.getUrl());
druidDataSource.setUsername(dataSourceProperties.getUsername());
druidDataSource.setPassword(dataSourceProperties.getPassword());
druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName());
druidDataSource.setInitialSize(0);
druidDataSource.setMaxActive(180);
druidDataSource.setMaxWait(60000);
druidDataSource.setMinIdle(0);
druidDataSource.setValidationQuery("Select 1 from DUAL");
druidDataSource.setTestOnBorrow(false);
druidDataSource.setTestOnReturn(false);
druidDataSource.setTestWhileIdle(true);
druidDataSource.setTimeBetweenEvictionRunsMillis(60000);
druidDataSource.setMinEvictableIdleTimeMillis(180000);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(1800);
druidDataSource.setLogAbandoned(true);
try {
druidDataSource.setFilters("stat,wall,stat,log4j2");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return druidDataSource;
}
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
servletRegistrationBean.addInitParameter("loginUsername", "root");
servletRegistrationBean.addInitParameter("loginPassword", "root2020");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,");
return filterRegistrationBean;
}
}
|