parent
3630200fcb
commit
9ebceeaa03
|
|
@ -2,10 +2,3 @@
|
||||||
## 2018.03.05 spring boot 由1.5.10 升级到2.0.0
|
## 2018.03.05 spring boot 由1.5.10 升级到2.0.0
|
||||||
## 2018.03.15上传文件的大小配置修改spring.http.multipart改为spring.servlet.multipart
|
## 2018.03.15上传文件的大小配置修改spring.http.multipart改为spring.servlet.multipart
|
||||||
## 2018.04.14 layui升级到2.2.6
|
## 2018.04.14 layui升级到2.2.6
|
||||||
## 2018.05.16 修改druid
|
|
||||||
1. pom中删除druid依赖,改为druid-spring-boot-starter
|
|
||||||
2. 作废DruidConfig类,druid支持自动注入了,前缀spring.datasource.druid
|
|
||||||
源码com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper
|
|
||||||
3. 修改application.yml里的数据源配置,spring.datasource改为spring.datasource.druid
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
11
pom.xml
11
pom.xml
|
|
@ -82,11 +82,16 @@
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--druid改为starter的方式-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid</artifactId>
|
||||||
<version>1.1.9</version>
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- druid需要此日志包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,29 @@
|
||||||
package com.boot.security.server.config;
|
package com.boot.security.server.config;
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import java.sql.SQLException;
|
||||||
import com.alibaba.druid.support.http.StatViewServlet;
|
|
||||||
import com.alibaba.druid.support.http.WebStatFilter;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
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.boot.web.servlet.ServletRegistrationBean;
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
import java.sql.SQLException;
|
import com.alibaba.druid.support.http.StatViewServlet;
|
||||||
|
import com.alibaba.druid.support.http.WebStatFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Druid数据源配置<br>
|
* Druid数据源配置
|
||||||
* 2018.05.16 作废该配置类,因为druid提供了druid-spring-boot-starter,看下pom.xml<br>
|
|
||||||
* 直接在bootstrap.yml里就能配置druid数据源了<br>
|
|
||||||
* 前缀spring.datasource.druid,具体看下druid自动注入源码 DruidDataSourceWrapper
|
|
||||||
*
|
*
|
||||||
* @author 小威老师
|
* @author 小威老师
|
||||||
* @see com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper
|
*
|
||||||
*/
|
*/
|
||||||
//@Configuration
|
@Configuration
|
||||||
@Deprecated
|
|
||||||
public class DruidConfig {
|
public class DruidConfig {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||||
|
|
@ -59,9 +58,9 @@ public class DruidConfig {
|
||||||
* 数据源配置
|
* 数据源配置
|
||||||
*
|
*
|
||||||
* @author 小威老师
|
* @author 小威老师
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
// @ConfigurationProperties(prefix = "spring.datasource")
|
@ConfigurationProperties(prefix = "spring.datasource")
|
||||||
@Deprecated
|
|
||||||
public class DataSourceProperties {
|
public class DataSourceProperties {
|
||||||
private String url;
|
private String url;
|
||||||
private String username;
|
private String username;
|
||||||
|
|
@ -226,9 +225,8 @@ public class DruidConfig {
|
||||||
this.connectionProperties = connectionProperties;
|
this.connectionProperties = connectionProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Bean
|
@Bean
|
||||||
// @Primary
|
@Primary
|
||||||
@Deprecated
|
|
||||||
public DataSource dataSource() {
|
public DataSource dataSource() {
|
||||||
DruidDataSource datasource = new DruidDataSource();
|
DruidDataSource datasource = new DruidDataSource();
|
||||||
datasource.setUrl(url);
|
datasource.setUrl(url);
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
package com.boot.security.server.service.impl;
|
package com.boot.security.server.service.impl;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.boot.security.server.dto.LoginUser;
|
import com.boot.security.server.dto.LoginUser;
|
||||||
import com.boot.security.server.dto.Token;
|
import com.boot.security.server.dto.Token;
|
||||||
import com.boot.security.server.service.SysLogService;
|
import com.boot.security.server.service.SysLogService;
|
||||||
import com.boot.security.server.service.TokenService;
|
import com.boot.security.server.service.TokenService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* token存到redis的实现类<br>
|
* token存到redis的实现类<br>
|
||||||
|
|
@ -19,7 +21,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
//@Service
|
@Service
|
||||||
public class TokenServiceImpl implements TokenService {
|
public class TokenServiceImpl implements TokenService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
* jwt实现的token
|
* jwt实现的token
|
||||||
*
|
*
|
||||||
* @author 小威老师
|
* @author 小威老师
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Primary
|
@Primary
|
||||||
@Service
|
@Service
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/boot_security?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
url: jdbc:mysql://localhost:3306/boot_security?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||||
username: root
|
username: root
|
||||||
|
|
@ -33,7 +32,6 @@ spring:
|
||||||
redis:
|
redis:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 6379
|
port: 6379
|
||||||
password:
|
|
||||||
mail:
|
mail:
|
||||||
default-encoding: UTF-8
|
default-encoding: UTF-8
|
||||||
host: smtp.163.com
|
host: smtp.163.com
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue