From 2a6fd29ba1487caae6e7ff3f97c93aaee918d8da Mon Sep 17 00:00:00 2001 From: wangkang Date: Tue, 3 Jul 2018 11:12:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- udf-server/pom.xml | 4 ++-- udf-server/udf-admin-server/pom.xml | 2 +- .../server/UdfAdminServerApplication.java | 3 ++- .../main/resources/bootstrap-dev.properties | 4 ++-- .../main/resources/bootstrap-dev.properties | 4 ++-- udf-starter/pom.xml | 4 ++-- .../java/org/itkk/udf/auth/RmsFilter.java | 3 ++- .../udf/cache/redis/CacheRedisConfig.java | 24 ++++++++++--------- .../udf/cache/redis/DefRedisCachePrefix.java | 5 ++-- udf-starter/udf-starter-core/pom.xml | 2 -- .../core/domain/aliyun/oss/OssListParam.java | 2 +- .../exception/handle/ExceptionController.java | 6 ++--- .../handle/ExceptionControllerConfig.java | 6 +---- .../xss/XssHttpServletRequestWrapper.java | 17 +++---------- 14 files changed, 37 insertions(+), 49 deletions(-) diff --git a/udf-server/pom.xml b/udf-server/pom.xml index be4ed06..8899b13 100644 --- a/udf-server/pom.xml +++ b/udf-server/pom.xml @@ -14,8 +14,8 @@ ${maven.build.timestamp} 1.0 1.0 - 2.0.3.RELEASE - Finchley.RELEASE + 1.5.14.RELEASE + Edgware.SR3 UTF-8 1.8 3.7.0 diff --git a/udf-server/udf-admin-server/pom.xml b/udf-server/udf-admin-server/pom.xml index 2c13367..8e6daa3 100644 --- a/udf-server/udf-admin-server/pom.xml +++ b/udf-server/udf-admin-server/pom.xml @@ -49,7 +49,7 @@ org.springframework.cloud - spring-cloud-starter-netflix-turbine + spring-cloud-starter-turbine diff --git a/udf-server/udf-admin-server/src/main/java/org/itkk/udf/admin/server/UdfAdminServerApplication.java b/udf-server/udf-admin-server/src/main/java/org/itkk/udf/admin/server/UdfAdminServerApplication.java index 6584ce8..a5b74a1 100644 --- a/udf-server/udf-admin-server/src/main/java/org/itkk/udf/admin/server/UdfAdminServerApplication.java +++ b/udf-server/udf-admin-server/src/main/java/org/itkk/udf/admin/server/UdfAdminServerApplication.java @@ -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; + /** * 描述 : 系统入口 * diff --git a/udf-server/udf-admin-server/src/main/resources/bootstrap-dev.properties b/udf-server/udf-admin-server/src/main/resources/bootstrap-dev.properties index c5ac248..b8a4dbc 100644 --- a/udf-server/udf-admin-server/src/main/resources/bootstrap-dev.properties +++ b/udf-server/udf-admin-server/src/main/resources/bootstrap-dev.properties @@ -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) ######################################################## diff --git a/udf-server/udf-eureka-config-server/src/main/resources/bootstrap-dev.properties b/udf-server/udf-eureka-config-server/src/main/resources/bootstrap-dev.properties index 04556d1..e92b6f8 100644 --- a/udf-server/udf-eureka-config-server/src/main/resources/bootstrap-dev.properties +++ b/udf-server/udf-eureka-config-server/src/main/resources/bootstrap-dev.properties @@ -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) ######################################################## diff --git a/udf-starter/pom.xml b/udf-starter/pom.xml index 7cc3b8a..01bb7f0 100644 --- a/udf-starter/pom.xml +++ b/udf-starter/pom.xml @@ -12,8 +12,8 @@ 1.0 - 2.0.3.RELEASE - Finchley.RELEASE + 1.5.14.RELEASE + Edgware.SR3 UTF-8 1.8 3.7.0 diff --git a/udf-starter/udf-starter-auth/src/main/java/org/itkk/udf/auth/RmsFilter.java b/udf-starter/udf-starter-auth/src/main/java/org/itkk/udf/auth/RmsFilter.java index 6808a7b..69a80f1 100644 --- a/udf-starter/udf-starter-auth/src/main/java/org/itkk/udf/auth/RmsFilter.java +++ b/udf-starter/udf-starter-auth/src/main/java/org/itkk/udf/auth/RmsFilter.java @@ -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 diff --git a/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/CacheRedisConfig.java b/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/CacheRedisConfig.java index 281cf8c..f63e446 100644 --- a/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/CacheRedisConfig.java +++ b/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/CacheRedisConfig.java @@ -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 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 diff --git a/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/DefRedisCachePrefix.java b/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/DefRedisCachePrefix.java index 0bb941d..e52e2cd 100644 --- a/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/DefRedisCachePrefix.java +++ b/udf-starter/udf-starter-cache-redis/src/main/java/org/itkk/udf/cache/redis/DefRedisCachePrefix.java @@ -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(":")); } diff --git a/udf-starter/udf-starter-core/pom.xml b/udf-starter/udf-starter-core/pom.xml index 40086d7..49542ac 100644 --- a/udf-starter/udf-starter-core/pom.xml +++ b/udf-starter/udf-starter-core/pom.xml @@ -45,12 +45,10 @@ spring-boot-starter-actuator - org.springframework.boot diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/domain/aliyun/oss/OssListParam.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/domain/aliyun/oss/OssListParam.java index 5e3d66c..e5a9d3e 100644 --- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/domain/aliyun/oss/OssListParam.java +++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/domain/aliyun/oss/OssListParam.java @@ -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; /** diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionController.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionController.java index 044951d..29474db 100644 --- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionController.java +++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionController.java @@ -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; diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionControllerConfig.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionControllerConfig.java index b15a562..d2f23da 100644 --- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionControllerConfig.java +++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/exception/handle/ExceptionControllerConfig.java @@ -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; diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/xss/XssHttpServletRequestWrapper.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/xss/XssHttpServletRequestWrapper.java index 03e6ea9..256b50d 100644 --- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/xss/XssHttpServletRequestWrapper.java +++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/core/xss/XssHttpServletRequestWrapper.java @@ -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; }