更新到 springboot2 & F版本 (未完成)

This commit is contained in:
wangkang
2018-07-03 11:03:55 +08:00
parent 67551ce448
commit 741c287c73
14 changed files with 50 additions and 37 deletions
+2 -2
View File
@@ -14,8 +14,8 @@
<project.build.date>${maven.build.timestamp}</project.build.date>
<udf-starter.version>1.0</udf-starter.version>
<ew.version>1.0</ew.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<springcloud.version>Edgware.SR3</springcloud.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
<springcloud.version>Finchley.RELEASE</springcloud.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+1 -1
View File
@@ -49,7 +49,7 @@
<!-- spring-cloud-starter-hystrix-dashboard 断路器-监控面板 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency>
<!-- spring-boot-starter-security -->
<dependency>
@@ -6,6 +6,7 @@
*/
package org.itkk.udf.admin.server;
import de.codecentric.boot.admin.config.EnableAdminServer;
import org.itkk.udf.core.BaseApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
@@ -14,8 +15,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import de.codecentric.boot.admin.config.EnableAdminServer;
/**
* 描述 : 系统入口
*
@@ -1,8 +1,8 @@
########################################################
###security (must reboot)
########################################################
security.user.name=admin
security.user.password=123456
spring.security.user.name=admin
spring.security.user.password=123456
########################################################
###eureka.client ( EurekaInstanceConfigBean , EurekaClientConfigBean , EurekaServerConfigBean ) (must reboot)
########################################################
@@ -1,8 +1,8 @@
########################################################
###security (must reboot)
########################################################
security.user.name=admin
security.user.password=123456
spring.security.user.name=admin
spring.security.user.password=123456
########################################################
###eureka.environment ( EurekaServerBootstrap ) (must reboot)
########################################################
@@ -11,6 +11,7 @@ eureka.environment=${spring.profiles.active}
###eureka.instance ( EurekaInstanceConfigBean ) (must reboot)
########################################################
eureka.instance.preferIpAddress=true
eureka.instance.instanceId=${spring.cloud.client.ipAddress}:${server.port}
########################################################
###eureka.client (EurekaClientConfigBean , EurekaServerConfigBean ) (must reboot)
########################################################
+2 -2
View File
@@ -12,8 +12,8 @@
<!-- 公共参数 -->
<properties>
<udf-starter.version>1.0</udf-starter.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<springcloud.version>Edgware.SR3</springcloud.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
<springcloud.version>Finchley.RELEASE</springcloud.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
@@ -10,7 +10,6 @@ import org.itkk.udf.rms.RmsProperties;
import org.itkk.udf.rms.meta.ApplicationMeta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
@@ -75,7 +74,7 @@ public class RmsFilter extends ZuulFilter {
@Override
public String filterType() {
return FilterConstants.PRE_TYPE;
return "pre";
}
@Override
@@ -3,12 +3,9 @@ package org.itkk.udf.cache.redis;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.itkk.udf.core.ApplicationConfig;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
@@ -35,16 +32,17 @@ public class CacheRedisConfig {
* @param redisTemplate redisTemplate
* @return CacheManager
*/
@Bean
public CacheManager cacheManager(ApplicationConfig applicationConfig, CacheRedisProperties cacheRedisProperties, RedisTemplate<Object, Object> redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setTransactionAware(true);
cacheManager.setUsePrefix(cacheRedisProperties.getUsePrefix());
cacheManager.setCachePrefix(new DefRedisCachePrefix(cacheRedisProperties.getPrefix()));
cacheManager.setDefaultExpiration(cacheRedisProperties.getDefaultExpiration());
cacheManager.setExpires(cacheRedisProperties.getNames());
return cacheManager;
}
//@Bean
//public CacheManager cacheManager(ApplicationConfig applicationConfig, CacheRedisProperties cacheRedisProperties, RedisConnectionFactory factory) {
// RedisCacheManager cacheManager= RedisCacheManager.create(factory);
// cacheManager.
// cacheManager.setTransactionAware(true);
// cacheManager.setUsePrefix(cacheRedisProperties.getUsePrefix());
// cacheManager.setCachePrefix(new DefRedisCachePrefix(cacheRedisProperties.getPrefix()));
// cacheManager.setDefaultExpiration(cacheRedisProperties.getDefaultExpiration());
// cacheManager.setExpires(cacheRedisProperties.getNames());
// return cacheManager;
//}
/**
* redisTemplate
@@ -1,13 +1,12 @@
package org.itkk.udf.cache.redis;
import org.springframework.data.redis.cache.RedisCachePrefix;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* DefRedisCachePrefix
*/
public class DefRedisCachePrefix implements RedisCachePrefix {
public class DefRedisCachePrefix {
/**
* serializer
*/
@@ -28,7 +27,7 @@ public class DefRedisCachePrefix implements RedisCachePrefix {
}
@Override
//@Override
public byte[] prefix(String cacheName) {
return serializer.serialize(prefix.concat(":"));
}
+2
View File
@@ -45,10 +45,12 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- spring-boot-actuator-docs -->
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-docs</artifactId>
</dependency>
-->
<!-- springboot configuration-processor -->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -3,8 +3,8 @@ package org.itkk.udf.core.domain.aliyun.oss;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@@ -8,10 +8,10 @@ import org.itkk.udf.core.exception.ErrorResult;
import org.itkk.udf.core.exception.PermissionException;
import org.itkk.udf.core.exception.alert.IExceptionAlert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.AbstractErrorController;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.autoconfigure.web.ErrorViewResolver;
import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -4,8 +4,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.*;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;
@@ -6,6 +6,7 @@
*/
package org.itkk.udf.core.xss;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.util.HtmlUtils;
import javax.servlet.http.HttpServletRequest;
@@ -30,13 +31,19 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
@Override
public String getHeader(String name) {
String value = super.getHeader(name);
return HtmlUtils.htmlEscape(value);
if (StringUtils.isNotBlank(value)) {
return HtmlUtils.htmlEscape(value);
}
return null;
}
@Override
public String getParameter(String name) {
String value = super.getParameter(name);
return HtmlUtils.htmlEscape(value);
if (StringUtils.isNotBlank(value)) {
return HtmlUtils.htmlEscape(value);
}
return null;
}
@Override
@@ -46,7 +53,11 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
int length = values.length;
String[] escapseValues = new String[length];
for (int i = 0; i < length; i++) {
escapseValues[i] = HtmlUtils.htmlEscape(values[i]);
if (StringUtils.isNotBlank(values[i])) {
escapseValues[i] = HtmlUtils.htmlEscape(values[i]);
} else {
escapseValues[i] = null;
}
}
return escapseValues;
}