1. 接入多源数据
This commit is contained in:
587
ruoyi/pom.xml
587
ruoyi/pom.xml
@ -1,287 +1,302 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.2.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>ruoyi</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依管理系统</description>
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.1.1.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version>
|
<mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version>
|
||||||
<pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version>
|
<pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version>
|
||||||
<fastjson.version>1.2.68</fastjson.version>
|
<fastjson.version>1.2.68</fastjson.version>
|
||||||
<druid.version>1.1.14</druid.version>
|
<druid.version>1.1.14</druid.version>
|
||||||
<commons.io.version>2.5</commons.io.version>
|
<commons.io.version>2.5</commons.io.version>
|
||||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||||
<bitwalker.version>1.19</bitwalker.version>
|
<bitwalker.version>1.19</bitwalker.version>
|
||||||
<jwt.version>0.9.0</jwt.version>
|
<jwt.version>0.9.0</jwt.version>
|
||||||
<swagger.version>2.9.2</swagger.version>
|
<swagger.version>2.9.2</swagger.version>
|
||||||
<poi.version>3.17</poi.version>
|
<poi.version>3.17</poi.version>
|
||||||
<oshi.version>3.9.1</oshi.version>
|
<oshi.version>3.9.1</oshi.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringBoot 核心包 -->
|
<!-- SpringBoot 核心包 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot 测试 -->
|
<!-- SpringBoot 测试 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot 拦截器 -->
|
<!-- SpringBoot 拦截器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot Web容器 -->
|
<!-- SpringBoot Web容器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring-boot-devtools -->
|
<!-- spring-boot-devtools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring security 安全认证 -->
|
<!-- spring security 安全认证 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- redis 缓存操作 -->
|
<!-- redis 缓存操作 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- pool 对象池 -->
|
<!-- pool 对象池 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Mysql驱动包 -->
|
<!-- Mysql驱动包 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<!-- SpringBoot集成mybatis框架 -->
|
<groupId>com.microsoft.sqlserver</groupId>
|
||||||
<dependency>
|
<artifactId>mssql-jdbc</artifactId>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<scope>runtime</scope>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
</dependency>
|
||||||
<version>${mybatis.spring.boot.starter.version}</version>
|
|
||||||
</dependency>
|
<!-- SpringBoot集成mybatis框架 -->
|
||||||
|
<dependency>
|
||||||
<!-- pagehelper 分页插件 -->
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<dependency>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<groupId>com.github.pagehelper</groupId>
|
<version>${mybatis.spring.boot.starter.version}</version>
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
</dependency>
|
||||||
<version>${pagehelper.spring.boot.starter.version}</version>
|
|
||||||
</dependency>
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
<!--阿里数据库连接池 -->
|
<groupId>com.github.pagehelper</groupId>
|
||||||
<dependency>
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
<groupId>com.alibaba</groupId>
|
<version>${pagehelper.spring.boot.starter.version}</version>
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
</dependency>
|
||||||
<version>${druid.version}</version>
|
|
||||||
</dependency>
|
<!--阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
<!--常用工具类 -->
|
<groupId>com.alibaba</groupId>
|
||||||
<dependency>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<groupId>org.apache.commons</groupId>
|
<version>${druid.version}</version>
|
||||||
<artifactId>commons-lang3</artifactId>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<!--常用工具类 -->
|
||||||
<!--io常用工具类 -->
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.apache.commons</groupId>
|
||||||
<groupId>commons-io</groupId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<artifactId>commons-io</artifactId>
|
</dependency>
|
||||||
<version>${commons.io.version}</version>
|
|
||||||
</dependency>
|
<!--io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
<!--文件上传工具类 -->
|
<groupId>commons-io</groupId>
|
||||||
<dependency>
|
<artifactId>commons-io</artifactId>
|
||||||
<groupId>commons-fileupload</groupId>
|
<version>${commons.io.version}</version>
|
||||||
<artifactId>commons-fileupload</artifactId>
|
</dependency>
|
||||||
<version>${commons.fileupload.version}</version>
|
|
||||||
</dependency>
|
<!--文件上传工具类 -->
|
||||||
|
<dependency>
|
||||||
<!-- 解析客户端操作系统、浏览器等 -->
|
<groupId>commons-fileupload</groupId>
|
||||||
<dependency>
|
<artifactId>commons-fileupload</artifactId>
|
||||||
<groupId>eu.bitwalker</groupId>
|
<version>${commons.fileupload.version}</version>
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
</dependency>
|
||||||
<version>${bitwalker.version}</version>
|
|
||||||
</dependency>
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
<!-- 阿里JSON解析器 -->
|
<groupId>eu.bitwalker</groupId>
|
||||||
<dependency>
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
<groupId>com.alibaba</groupId>
|
<version>${bitwalker.version}</version>
|
||||||
<artifactId>fastjson</artifactId>
|
</dependency>
|
||||||
<version>${fastjson.version}</version>
|
|
||||||
</dependency>
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
<!--Spring框架基本的核心工具-->
|
<groupId>com.alibaba</groupId>
|
||||||
<dependency>
|
<artifactId>fastjson</artifactId>
|
||||||
<groupId>org.springframework</groupId>
|
<version>${fastjson.version}</version>
|
||||||
<artifactId>spring-context-support</artifactId>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<!--Spring框架基本的核心工具-->
|
||||||
<!--Token生成与解析-->
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.springframework</groupId>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
<artifactId>jjwt</artifactId>
|
</dependency>
|
||||||
<version>${jwt.version}</version>
|
|
||||||
</dependency>
|
<!--Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
<!-- swagger2-->
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<dependency>
|
<artifactId>jjwt</artifactId>
|
||||||
<groupId>io.springfox</groupId>
|
<version>${jwt.version}</version>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
</dependency>
|
||||||
<version>${swagger.version}</version>
|
|
||||||
<exclusions>
|
<dependency>
|
||||||
<exclusion>
|
<groupId>com.baomidou</groupId>
|
||||||
<groupId>io.swagger</groupId>
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<version>2.5.7</version>
|
||||||
</exclusion>
|
</dependency>
|
||||||
<exclusion>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>swagger-models</artifactId>
|
<artifactId>spring-boot-actuator</artifactId>
|
||||||
</exclusion>
|
</dependency>
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
<!-- swagger2-->
|
||||||
|
<dependency>
|
||||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
<groupId>io.springfox</groupId>
|
||||||
<dependency>
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
<groupId>io.swagger</groupId>
|
<version>${swagger.version}</version>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<exclusions>
|
||||||
<version>1.5.21</version>
|
<exclusion>
|
||||||
</dependency>
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<dependency>
|
</exclusion>
|
||||||
<groupId>io.swagger</groupId>
|
<exclusion>
|
||||||
<artifactId>swagger-models</artifactId>
|
<groupId>io.swagger</groupId>
|
||||||
<version>1.5.21</version>
|
<artifactId>swagger-models</artifactId>
|
||||||
</dependency>
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
<!-- swagger2-UI-->
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<dependency>
|
||||||
<version>${swagger.version}</version>
|
<groupId>io.swagger</groupId>
|
||||||
</dependency>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>1.5.21</version>
|
||||||
<!-- 获取系统信息 -->
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.oshi</groupId>
|
<dependency>
|
||||||
<artifactId>oshi-core</artifactId>
|
<groupId>io.swagger</groupId>
|
||||||
<version>${oshi.version}</version>
|
<artifactId>swagger-models</artifactId>
|
||||||
</dependency>
|
<version>1.5.21</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.java.dev.jna</groupId>
|
<!-- swagger2-UI-->
|
||||||
<artifactId>jna</artifactId>
|
<dependency>
|
||||||
</dependency>
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
<dependency>
|
<version>${swagger.version}</version>
|
||||||
<groupId>net.java.dev.jna</groupId>
|
</dependency>
|
||||||
<artifactId>jna-platform</artifactId>
|
|
||||||
</dependency>
|
<!-- 获取系统信息 -->
|
||||||
|
<dependency>
|
||||||
<!-- excel工具 -->
|
<groupId>com.github.oshi</groupId>
|
||||||
<dependency>
|
<artifactId>oshi-core</artifactId>
|
||||||
<groupId>org.apache.poi</groupId>
|
<version>${oshi.version}</version>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
</dependency>
|
||||||
<version>${poi.version}</version>
|
|
||||||
</dependency>
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
<!--velocity代码生成使用模板 -->
|
<artifactId>jna</artifactId>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
|
||||||
<artifactId>velocity</artifactId>
|
<dependency>
|
||||||
<version>${velocity.version}</version>
|
<groupId>net.java.dev.jna</groupId>
|
||||||
</dependency>
|
<artifactId>jna-platform</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- 定时任务 -->
|
|
||||||
<dependency>
|
<!-- excel工具 -->
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
<dependency>
|
||||||
<artifactId>quartz</artifactId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<exclusions>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
<exclusion>
|
<version>${poi.version}</version>
|
||||||
<groupId>com.mchange</groupId>
|
</dependency>
|
||||||
<artifactId>c3p0</artifactId>
|
|
||||||
</exclusion>
|
<!--velocity代码生成使用模板 -->
|
||||||
</exclusions>
|
<dependency>
|
||||||
</dependency>
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity</artifactId>
|
||||||
</dependencies>
|
<version>${velocity.version}</version>
|
||||||
|
</dependency>
|
||||||
<build>
|
|
||||||
<finalName>${project.artifactId}</finalName>
|
<!-- 定时任务 -->
|
||||||
<plugins>
|
<dependency>
|
||||||
<plugin>
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>quartz</artifactId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<exclusions>
|
||||||
<configuration>
|
<exclusion>
|
||||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
<groupId>com.mchange</groupId>
|
||||||
</configuration>
|
<artifactId>c3p0</artifactId>
|
||||||
</plugin>
|
</exclusion>
|
||||||
</plugins>
|
</exclusions>
|
||||||
</build>
|
</dependency>
|
||||||
|
|
||||||
<repositories>
|
</dependencies>
|
||||||
<repository>
|
|
||||||
<id>public</id>
|
<build>
|
||||||
<name>aliyun nexus</name>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
<plugins>
|
||||||
<releases>
|
<plugin>
|
||||||
<enabled>true</enabled>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</releases>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</repository>
|
<configuration>
|
||||||
</repositories>
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
<pluginRepositories>
|
</plugin>
|
||||||
<pluginRepository>
|
</plugins>
|
||||||
<id>public</id>
|
</build>
|
||||||
<name>aliyun nexus</name>
|
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
<repositories>
|
||||||
<releases>
|
<repository>
|
||||||
<enabled>true</enabled>
|
<id>public</id>
|
||||||
</releases>
|
<name>aliyun nexus</name>
|
||||||
<snapshots>
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
<enabled>false</enabled>
|
<releases>
|
||||||
</snapshots>
|
<enabled>true</enabled>
|
||||||
</pluginRepository>
|
</releases>
|
||||||
</pluginRepositories>
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,30 +1,31 @@
|
|||||||
package com.ruoyi;
|
package com.ruoyi;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
/**
|
|
||||||
* 启动程序
|
/**
|
||||||
*
|
* 启动程序
|
||||||
* @author ruoyi
|
*
|
||||||
*/
|
* @author ruoyi
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
*/
|
||||||
public class RuoYiApplication
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
|
||||||
{
|
public class RuoYiApplication
|
||||||
public static void main(String[] args)
|
{
|
||||||
{
|
public static void main(String[] args)
|
||||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
{
|
||||||
SpringApplication.run(RuoYiApplication.class, args);
|
System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
SpringApplication.run(RuoYiApplication.class, args);
|
||||||
" .-------. ____ __ \n" +
|
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
" | _ _ \\ \\ \\ / / \n" +
|
" .-------. ____ __ \n" +
|
||||||
" | ( ' ) | \\ _. / ' \n" +
|
" | _ _ \\ \\ \\ / / \n" +
|
||||||
" |(_ o _) / _( )_ .' \n" +
|
" | ( ' ) | \\ _. / ' \n" +
|
||||||
" | (_,_).' __ ___(_ o _)' \n" +
|
" |(_ o _) / _( )_ .' \n" +
|
||||||
" | |\\ \\ | || |(_,_)' \n" +
|
" | (_,_).' __ ___(_ o _)' \n" +
|
||||||
" | | \\ `' /| `-' / \n" +
|
" | |\\ \\ | || |(_,_)' \n" +
|
||||||
" | | \\ / \\ / \n" +
|
" | | \\ `' /| `-' / \n" +
|
||||||
" ''-' `'-' `-..-' ");
|
" | | \\ / \\ / \n" +
|
||||||
}
|
" ''-' `'-' `-..-' ");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,126 +1,126 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||||
import com.alibaba.druid.util.Utils;
|
import com.alibaba.druid.util.Utils;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
|
||||||
import com.ruoyi.framework.config.properties.DruidProperties;
|
import com.ruoyi.framework.config.properties.DruidProperties;
|
||||||
import com.ruoyi.framework.datasource.DynamicDataSource;
|
import com.ruoyi.framework.datasource.DynamicDataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* druid 配置多数据源
|
* druid 配置多数据源
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class DruidConfig
|
public class DruidConfig
|
||||||
{
|
{
|
||||||
@Bean
|
// @Bean
|
||||||
@ConfigurationProperties("spring.datasource.druid.master")
|
// @ConfigurationProperties("spring.datasource.druid.master")
|
||||||
public DataSource masterDataSource(DruidProperties druidProperties)
|
// public DataSource masterDataSource(DruidProperties druidProperties)
|
||||||
{
|
// {
|
||||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
return druidProperties.dataSource(dataSource);
|
// return druidProperties.dataSource(dataSource);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean
|
// @Bean
|
||||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
// @ConfigurationProperties("spring.datasource.druid.slave")
|
||||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
// @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||||
public DataSource slaveDataSource(DruidProperties druidProperties)
|
// public DataSource slaveDataSource(DruidProperties druidProperties)
|
||||||
{
|
// {
|
||||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
return druidProperties.dataSource(dataSource);
|
// return druidProperties.dataSource(dataSource);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean(name = "dynamicDataSource")
|
// @Bean(name = "dynamicDataSource")
|
||||||
@Primary
|
// @Primary
|
||||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
// public DynamicDataSource dataSource(DataSource masterDataSource)
|
||||||
{
|
// {
|
||||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
// Map<Object, Object> targetDataSources = new HashMap<>();
|
||||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
// targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
// setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
// return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 设置数据源
|
// * 设置数据源
|
||||||
*
|
// *
|
||||||
* @param targetDataSources 备选数据源集合
|
// * @param targetDataSources 备选数据源集合
|
||||||
* @param sourceName 数据源名称
|
// * @param sourceName 数据源名称
|
||||||
* @param beanName bean名称
|
// * @param beanName bean名称
|
||||||
*/
|
// */
|
||||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
|
// public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
DataSource dataSource = SpringUtils.getBean(beanName);
|
// DataSource dataSource = SpringUtils.getBean(beanName);
|
||||||
targetDataSources.put(sourceName, dataSource);
|
// targetDataSources.put(sourceName, dataSource);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去除监控页面底部的广告
|
* 去除监控页面底部的广告
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
|
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
|
||||||
{
|
{
|
||||||
// 获取web监控页面的参数
|
// 获取web监控页面的参数
|
||||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||||
// 提取common.js的配置路径
|
// 提取common.js的配置路径
|
||||||
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||||
final String filePath = "support/http/resources/js/common.js";
|
final String filePath = "support/http/resources/js/common.js";
|
||||||
// 创建filter进行过滤
|
// 创建filter进行过滤
|
||||||
Filter filter = new Filter()
|
Filter filter = new Filter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
// 重置缓冲区,响应头不会被重置
|
// 重置缓冲区,响应头不会被重置
|
||||||
response.resetBuffer();
|
response.resetBuffer();
|
||||||
// 获取common.js
|
// 获取common.js
|
||||||
String text = Utils.readFromResource(filePath);
|
String text = Utils.readFromResource(filePath);
|
||||||
// 正则替换banner, 除去底部的广告信息
|
// 正则替换banner, 除去底部的广告信息
|
||||||
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
|
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
|
||||||
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||||
response.getWriter().write(text);
|
response.getWriter().write(text);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||||
registrationBean.setFilter(filter);
|
registrationBean.setFilter(filter);
|
||||||
registrationBean.addUrlPatterns(commonJsPattern);
|
registrationBean.addUrlPatterns(commonJsPattern);
|
||||||
return registrationBean;
|
return registrationBean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,57 +1,65 @@
|
|||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
druid:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
statViewServlet:
|
||||||
druid:
|
enabled: true
|
||||||
# 主库数据源
|
# 设置白名单,不填则允许所有访问
|
||||||
master:
|
allow:
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url-pattern: /druid/*
|
||||||
username: root
|
# 控制台管理用户名和密码
|
||||||
password: password
|
login-username:
|
||||||
# 从库数据源
|
login-password:
|
||||||
slave:
|
dynamic:
|
||||||
# 从数据源开关/默认关闭
|
druid:
|
||||||
enabled: false
|
# 初始连接数
|
||||||
url:
|
initialSize: 5
|
||||||
username:
|
# 最小连接池数量
|
||||||
password:
|
minIdle: 10
|
||||||
# 初始连接数
|
# 最大连接池数量
|
||||||
initialSize: 5
|
maxActive: 20
|
||||||
# 最小连接池数量
|
# 配置获取连接等待超时的时间
|
||||||
minIdle: 10
|
maxWait: 60000
|
||||||
# 最大连接池数量
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
maxActive: 20
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
# 配置获取连接等待超时的时间
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
maxWait: 60000
|
minEvictableIdleTimeMillis: 300000
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
maxEvictableIdleTimeMillis: 900000
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
# 配置检测连接是否有效
|
||||||
minEvictableIdleTimeMillis: 300000
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
testWhileIdle: true
|
||||||
maxEvictableIdleTimeMillis: 900000
|
testOnBorrow: false
|
||||||
# 配置检测连接是否有效
|
testOnReturn: false
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
webStatFilter:
|
||||||
testWhileIdle: true
|
enabled: true
|
||||||
testOnBorrow: false
|
filter:
|
||||||
testOnReturn: false
|
stat:
|
||||||
webStatFilter:
|
enabled: true
|
||||||
enabled: true
|
# 慢SQL记录
|
||||||
statViewServlet:
|
log-slow-sql: true
|
||||||
enabled: true
|
slow-sql-millis: 1000
|
||||||
# 设置白名单,不填则允许所有访问
|
merge-sql: true
|
||||||
allow:
|
wall:
|
||||||
url-pattern: /druid/*
|
config:
|
||||||
# 控制台管理用户名和密码
|
multi-statement-allow: true
|
||||||
login-username:
|
|
||||||
login-password:
|
datasource:
|
||||||
filter:
|
# 主库数据源
|
||||||
stat:
|
master:
|
||||||
enabled: true
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
# 慢SQL记录
|
url: jdbc:mysql://localhost:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
log-slow-sql: true
|
username: root
|
||||||
slow-sql-millis: 1000
|
password: LOLm2dI2UQF#RxOf
|
||||||
merge-sql: true
|
# 从库数据源
|
||||||
wall:
|
slave:
|
||||||
config:
|
# 从数据源开关/默认关闭
|
||||||
multi-statement-allow: true
|
enabled: false
|
||||||
|
url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
teemlink:
|
||||||
|
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
|
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
|
||||||
|
username: sa
|
||||||
|
password: Lcdatacenter_888
|
Reference in New Issue
Block a user