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