This commit is contained in:
wangkang
2018-07-03 11:12:04 +08:00
parent 54cec2b0fb
commit 2a6fd29ba1
14 changed files with 37 additions and 49 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>2.0.3.RELEASE</springboot.version>
<springcloud.version>Finchley.RELEASE</springcloud.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<springcloud.version>Edgware.SR3</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-netflix-turbine</artifactId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
<!-- spring-boot-starter-security -->
<dependency>
@@ -6,7 +6,6 @@
*/
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;
@@ -15,6 +14,8 @@ 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)
########################################################
spring.security.user.name=admin
spring.security.user.password=123456
security.user.name=admin
security.user.password=123456
########################################################
###eureka.client ( EurekaInstanceConfigBean , EurekaClientConfigBean , EurekaServerConfigBean ) (must reboot)
########################################################
@@ -1,8 +1,8 @@
########################################################
###security (must reboot)
########################################################
spring.security.user.name=admin
spring.security.user.password=123456
security.user.name=admin
security.user.password=123456
########################################################
###eureka.environment ( EurekaServerBootstrap ) (must reboot)
########################################################
+2 -2
View File
@@ -12,8 +12,8 @@
<!-- 公共参数 -->
<properties>
<udf-starter.version>1.0</udf-starter.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
<springcloud.version>Finchley.RELEASE</springcloud.version>
<springboot.version>1.5.14.RELEASE</springboot.version>
<springcloud.version>Edgware.SR3</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,6 +10,7 @@ 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;
@@ -74,7 +75,7 @@ public class RmsFilter extends ZuulFilter {
@Override
public String filterType() {
return "pre";
return FilterConstants.PRE_TYPE;
}
@Override
@@ -3,9 +3,12 @@ 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;
@@ -32,17 +35,16 @@ public class CacheRedisConfig {
* @param redisTemplate redisTemplate
* @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;
//}
@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;
}
/**
* redisTemplate
@@ -1,12 +1,13 @@
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 {
public class DefRedisCachePrefix implements RedisCachePrefix {
/**
* serializer
*/
@@ -27,7 +28,7 @@ public class DefRedisCachePrefix {
}
//@Override
@Override
public byte[] prefix(String cacheName) {
return serializer.serialize(prefix.concat(":"));
}
-2
View File
@@ -45,12 +45,10 @@
<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.servlet.error.AbstractErrorController;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorViewResolver;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -4,12 +4,8 @@ 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.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.autoconfigure.web.*;
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,7 +6,6 @@
*/
package org.itkk.udf.core.xss;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.util.HtmlUtils;
import javax.servlet.http.HttpServletRequest;
@@ -31,19 +30,13 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
@Override
public String getHeader(String name) {
String value = super.getHeader(name);
if (StringUtils.isNotBlank(value)) {
return HtmlUtils.htmlEscape(value);
}
return null;
return HtmlUtils.htmlEscape(value);
}
@Override
public String getParameter(String name) {
String value = super.getParameter(name);
if (StringUtils.isNotBlank(value)) {
return HtmlUtils.htmlEscape(value);
}
return null;
return HtmlUtils.htmlEscape(value);
}
@Override
@@ -53,11 +46,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
int length = values.length;
String[] escapseValues = new String[length];
for (int i = 0; i < length; i++) {
if (StringUtils.isNotBlank(values[i])) {
escapseValues[i] = HtmlUtils.htmlEscape(values[i]);
} else {
escapseValues[i] = null;
}
escapseValues[i] = HtmlUtils.htmlEscape(values[i]);
}
return escapseValues;
}