Merge branch 'dev'

This commit is contained in:
冷冷 2019-04-04 21:17:52 +08:00
commit f13509b752
53 changed files with 260 additions and 194 deletions

View File

@ -0,0 +1,15 @@
### 版本信息
- pig版本:
- 操作系统:
- 是否修改包名:
### 报错信息 (注意格式化)
```angular2
这里粘贴代码或者、日志
```
###问题描述(包括回显步骤、截图
此项没有直接关闭、不予解决

View File

@ -6,7 +6,7 @@
**Pig Microservice Architecture**
- 基于 Spring Cloud Finchley 、Spring Security OAuth2 的RBAC权限管理系统
- 基于 Spring Cloud Greenwich 、Spring Security OAuth2 的RBAC权限管理系统
- 基于数据驱动视图的理念封装 Element-ui即使没有 vue 的使用经验也能快速上手
- 提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持
- 提供 lambda 、stream api 、webflux 的生产实践
@ -24,8 +24,8 @@
依赖 | 版本
---|---
Spring Boot | 2.0.8.RELEASE
Spring Cloud | Finchley.SR3
Spring Boot | 2.1.3.RELEASE
Spring Cloud | Greenwich.RELEASE
Spring Security OAuth2 | 2.3.3
Mybatis Plus | 3.1.0
hutool | 4.5.0

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-auth</artifactId>
@ -39,13 +39,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--security-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--JDBC相关-->
<dependency>

View File

@ -20,6 +20,7 @@ import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.security.component.PigWebResponseExceptionTranslator;
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@ -55,7 +56,8 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
private final RedisConnectionFactory redisConnectionFactory;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
@SneakyThrows
public void configure(ClientDetailsServiceConfigurer clients) {
PigClientDetailsService clientDetailsService = new PigClientDetailsService(dataSource);
clientDetailsService.setSelectClientDetailsSql(SecurityConstants.DEFAULT_SELECT_STATEMENT);
clientDetailsService.setFindClientDetailsSql(SecurityConstants.DEFAULT_FIND_STATEMENT);

View File

@ -18,6 +18,7 @@ package com.pig4cloud.pig.auth.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pig4cloud.pig.common.security.handler.MobileLoginSuccessHandler;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -51,7 +52,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
private AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
@Override
protected void configure(HttpSecurity http) throws Exception {
@SneakyThrows
protected void configure(HttpSecurity http) {
http
.authorizeRequests()
.antMatchers(
@ -63,7 +65,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
@SneakyThrows
public AuthenticationManager authenticationManagerBean() {
return super.authenticationManagerBean();
}

View File

@ -19,6 +19,7 @@ package com.pig4cloud.pig.auth.endpoint;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.service.PigUser;
@ -64,18 +65,28 @@ public class PigTokenEndpoint {
*
* @param authHeader Authorization
*/
@GetMapping("/logout")
@DeleteMapping("/logout")
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
if (StringUtils.hasText(authHeader)) {
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
return new R<>(false, "退出失败token 为空");
}
tokenStore.removeAccessToken(accessToken);
if (StrUtil.isBlank(authHeader)) {
return R.<Boolean>builder()
.code(CommonConstants.FAIL)
.data(Boolean.FALSE)
.msg("退出失败token 为空").build();
}
return new R<>(Boolean.TRUE);
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
return R.<Boolean>builder()
.code(CommonConstants.FAIL)
.data(Boolean.FALSE)
.msg("退出失败token 无效").build();
}
tokenStore.removeAccessToken(accessToken);
return R.<Boolean>builder()
.code(CommonConstants.SUCCESS)
.data(Boolean.TRUE)
.build();
}
/**
@ -106,7 +117,7 @@ public class PigTokenEndpoint {
}
List<Map<String, String>> list = new ArrayList<>();
if (StringUtils.isEmpty(MapUtil.getInt(params, CURRENT)) || StringUtils.isEmpty(MapUtil.getInt(params, CURRENT))) {
if (StringUtils.isEmpty(MapUtil.getInt(params, CURRENT)) || StringUtils.isEmpty(MapUtil.getInt(params, SIZE))) {
params.put(CURRENT, 1);
params.put(SIZE, 20);
}

View File

@ -15,6 +15,8 @@ spring:
discovery:
enabled: true
service-id: pig-config
main:
allow-bean-definition-overriding: true
# 注册中心配置
eureka:

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-common-core</artifactId>

View File

@ -16,59 +16,39 @@
package com.pig4cloud.pig.common.core.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import com.pig4cloud.pig.common.core.jackson.PigJavaTimeModule;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.ZoneId;
import java.util.Locale;
import java.util.TimeZone;
/**
* JacksonConfig
*
* @author: lengleng
* @author L.cm
* @author: lishangbu
* @date: 2019/2/1
* @date: 2018/10/22
*/
@Configuration
@ConditionalOnClass(ObjectMapper.class)
@AutoConfigureBefore(JacksonAutoConfiguration.class)
public class JacksonConfig {
/**
* 针对JDK 1.8的日期时间格式特殊处理
*
* @return ObjectMapper
*/
@Bean
public ObjectMapper getObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
// javaTimeModule只能手动注册参考https://github.com/FasterXML/jackson-modules-java8
objectMapper.registerModule(javaTimeModule);
// 忽略json字符串中不识别的属性
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// 忽略无法转换的对象
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
return objectMapper;
public Jackson2ObjectMapperBuilderCustomizer customizer() {
return builder -> {
builder.locale(Locale.CHINA);
builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
builder.modules(new PigJavaTimeModule());
};
}
}

View File

@ -23,7 +23,7 @@ package com.pig4cloud.pig.common.core.constant;
*/
public interface ServiceNameConstants {
/**
* 认证服务的SERVICEIDzuul 配置的对应
* 认证服务的SERVICEID
*/
String AUTH_SERVICE = "pig-auth";

View File

@ -20,6 +20,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
@ -46,7 +47,8 @@ import java.util.Properties;
public class DataScopeInterceptor extends AbstractSqlParserHandler implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
@SneakyThrows
public Object intercept(Invocation invocation) {
StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
this.sqlParser(metaObject);

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
* <p>
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.common.core.exception;
import lombok.NoArgsConstructor;
/**
* @author lengleng
* @date 2018年06月22日16:22:10
*/
@NoArgsConstructor
public class UnloginException extends RuntimeException {
private static final long serialVersionUID = 1L;
public UnloginException(String message) {
super(message);
}
public UnloginException(Throwable cause) {
super(cause);
}
public UnloginException(String message, Throwable cause) {
super(message, cause);
}
public UnloginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
* <p>
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.common.core.jackson;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
/**
* java 8 时间默认序列化
*
* @author L.cm
* @author lishanbu
*/
public class PigJavaTimeModule extends SimpleModule {
public PigJavaTimeModule() {
super(PackageVersion.VERSION);
this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
this.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
this.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
}
}

View File

@ -16,6 +16,7 @@
package com.pig4cloud.pig.common.core.util;
import lombok.experimental.UtilityClass;
import org.springframework.core.BridgeMethodResolver;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
@ -33,8 +34,9 @@ import java.lang.reflect.Method;
*
* @author L.cm
*/
@UtilityClass
public class ClassUtils extends org.springframework.util.ClassUtils {
private static final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
private final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
/**
* 获取方法参数信息
@ -43,7 +45,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
* @param parameterIndex 参数序号
* @return {MethodParameter}
*/
public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
public MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
return methodParameter;
@ -56,7 +58,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
* @param parameterIndex 参数序号
* @return {MethodParameter}
*/
public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
public MethodParameter getMethodParameter(Method method, int parameterIndex) {
MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
return methodParameter;
@ -70,7 +72,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
* @param <A> 泛型标记
* @return {Annotation}
*/
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
public <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
Class<?> targetClass = method.getDeclaringClass();
// The method may be on an interface, but we need attributes from the target class.
// If the target class is null, the method will be unchanged.
@ -95,7 +97,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
* @param <A> 泛型标记
* @return {Annotation}
*/
public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
public <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
// 先找方法再找方法上的类
A annotation = handlerMethod.getMethodAnnotation(annotationType);
if (null != annotation) {

View File

@ -16,6 +16,7 @@
package com.pig4cloud.pig.common.core.util;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
@ -92,7 +93,8 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
*/
@Override
public void destroy() throws Exception {
@SneakyThrows
public void destroy() {
SpringContextHolder.clearHolder();
}

View File

@ -20,6 +20,7 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.json.JSONUtil;
import com.pig4cloud.pig.common.core.exception.CheckedException;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpHeaders;
@ -45,9 +46,10 @@ import java.nio.charset.StandardCharsets;
* @author L.cm
*/
@Slf4j
@UtilityClass
public class WebUtils extends org.springframework.web.util.WebUtils {
private static final String BASIC_ = "Basic ";
private static final String UNKNOWN = "unknown";
private final String BASIC_ = "Basic ";
private final String UNKNOWN = "unknown";
/**
* 判断是否ajax请求
@ -56,7 +58,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param handlerMethod HandlerMethod
* @return 是否ajax请求
*/
public static boolean isBody(HandlerMethod handlerMethod) {
public boolean isBody(HandlerMethod handlerMethod) {
ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
return responseBody != null;
}
@ -67,7 +69,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param name cookie name
* @return cookie value
*/
public static String getCookieVal(String name) {
public String getCookieVal(String name) {
HttpServletRequest request = WebUtils.getRequest();
Assert.notNull(request, "request from RequestContextHolder is null");
return getCookieVal(request, name);
@ -80,7 +82,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param name cookie name
* @return cookie value
*/
public static String getCookieVal(HttpServletRequest request, String name) {
public String getCookieVal(HttpServletRequest request, String name) {
Cookie cookie = getCookie(request, name);
return cookie != null ? cookie.getValue() : null;
}
@ -91,7 +93,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param response HttpServletResponse
* @param key cookie key
*/
public static void removeCookie(HttpServletResponse response, String key) {
public void removeCookie(HttpServletResponse response, String key) {
setCookie(response, key, null, 0);
}
@ -103,7 +105,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param value cookie value
* @param maxAgeInSeconds maxage
*/
public static void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
cookie.setMaxAge(maxAgeInSeconds);
@ -116,7 +118,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
*
* @return {HttpServletRequest}
*/
public static HttpServletRequest getRequest() {
public HttpServletRequest getRequest() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
}
@ -125,7 +127,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
*
* @return {HttpServletResponse}
*/
public static HttpServletResponse getResponse() {
public HttpServletResponse getResponse() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
}
@ -135,7 +137,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param response HttpServletResponse
* @param result 结果对象
*/
public static void renderJson(HttpServletResponse response, Object result) {
public void renderJson(HttpServletResponse response, Object result) {
renderJson(response, result, MediaType.APPLICATION_JSON_UTF8_VALUE);
}
@ -146,7 +148,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param result 结果对象
* @param contentType contentType
*/
public static void renderJson(HttpServletResponse response, Object result, String contentType) {
public void renderJson(HttpServletResponse response, Object result, String contentType) {
response.setCharacterEncoding("UTF-8");
response.setContentType(contentType);
try (PrintWriter out = response.getWriter()) {
@ -161,7 +163,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
*
* @return {String}
*/
public static String getIP() {
public String getIP() {
return getIP(WebUtils.getRequest());
}
@ -171,7 +173,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @param request HttpServletRequest
* @return {String}
*/
public static String getIP(HttpServletRequest request) {
public String getIP(HttpServletRequest request) {
Assert.notNull(request, "HttpServletRequest is null");
String ip = request.getHeader("X-Requested-For");
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
@ -201,7 +203,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
* @return
*/
@SneakyThrows
public static String[] getClientId(ServerHttpRequest request) {
public String[] getClientId(ServerHttpRequest request) {
String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
if (header == null || !header.startsWith(BASIC_)) {

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-common-log</artifactId>
@ -35,13 +35,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--UPMS接口模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--安全依赖获取上下文信息-->
<dependency>

View File

@ -20,6 +20,7 @@ import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.log.event.SysLogEvent;
import com.pig4cloud.pig.common.log.util.SysLogUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@ -35,7 +36,8 @@ import org.aspectj.lang.annotation.Aspect;
public class SysLogAspect {
@Around("@annotation(sysLog)")
public Object around(ProceedingJoinPoint point, SysLog sysLog) throws Throwable {
@SneakyThrows
public Object around(ProceedingJoinPoint point, SysLog sysLog) {
String strClassName = point.getTarget().getClass().getName();
String strMethodName = point.getSignature().getName();
log.debug("[类名]:{},[方法]:{}", strClassName, strMethodName);

View File

@ -21,6 +21,7 @@ import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.HttpUtil;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import lombok.experimental.UtilityClass;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
@ -35,8 +36,9 @@ import java.util.Objects;
*
* @author L.cm
*/
@UtilityClass
public class SysLogUtils {
public static SysLog getSysLog() {
public SysLog getSysLog() {
HttpServletRequest request = ((ServletRequestAttributes) Objects
.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
SysLog sysLog = new SysLog();
@ -56,7 +58,7 @@ public class SysLogUtils {
*
* @return clientId
*/
private static String getClientId() {
private String getClientId() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof OAuth2Authentication) {
OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
@ -70,7 +72,7 @@ public class SysLogUtils {
*
* @return username
*/
private static String getUsername() {
private String getUsername() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) {
return null;

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-common-security</artifactId>
@ -35,18 +35,22 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
</dependency>
<!--UPMS API-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
</dependencies>
</project>

View File

@ -27,15 +27,14 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.exception.PigDeniedException;
import com.pig4cloud.pig.common.core.util.R;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
@ -55,11 +54,10 @@ public class PigAccessDeniedHandler extends OAuth2AccessDeniedHandler {
* @param request request
* @param response response
* @param authException authException
* @throws IOException IOException
* @throws ServletException ServletException
*/
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException authException) throws IOException, ServletException {
@SneakyThrows
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException authException) {
log.info("授权失败,禁止访问 {}", request.getRequestURI());
response.setCharacterEncoding(CommonConstants.UTF8);
response.setContentType(CommonConstants.CONTENT_TYPE);

View File

@ -16,6 +16,7 @@
package com.pig4cloud.pig.common.security.component;
import lombok.SneakyThrows;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -25,8 +26,6 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
/**
* @author lengleng
* @date 2019/03/08
@ -40,7 +39,8 @@ public class PigResourceServerAutoConfiguration {
RestTemplate restTemplate = new RestTemplate();
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
@Override
public void handleError(ClientHttpResponse response) throws IOException {
@SneakyThrows
public void handleError(ClientHttpResponse response) {
if (response.getRawStatusCode() != HttpStatus.BAD_REQUEST.value()) {
super.handleError(response);
}

View File

@ -17,6 +17,7 @@
package com.pig4cloud.pig.common.security.component;
import com.pig4cloud.pig.common.security.exception.*;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@ -44,7 +45,8 @@ public class PigWebResponseExceptionTranslator implements WebResponseExceptionTr
private ThrowableAnalyzer throwableAnalyzer = new DefaultThrowableAnalyzer();
@Override
public ResponseEntity<OAuth2Exception> translate(Exception e) throws Exception {
@SneakyThrows
public ResponseEntity<OAuth2Exception> translate(Exception e) {
// Try to extract a SpringSecurityException from the stacktrace
Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e);

View File

@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.util.R;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
@ -28,7 +29,6 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
@ -44,8 +44,9 @@ public class ResourceAuthExceptionEntryPoint implements AuthenticationEntryPoint
private final ObjectMapper objectMapper;
@Override
@SneakyThrows
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException {
AuthenticationException authException) {
response.setCharacterEncoding(CommonConstants.UTF8);
response.setContentType(CommonConstants.CONTENT_TYPE);
R<String> result = new R<>();

View File

@ -17,6 +17,7 @@
package com.pig4cloud.pig.common.security.service;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import lombok.SneakyThrows;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.provider.ClientDetails;
@ -41,11 +42,11 @@ public class PigClientDetailsService extends JdbcClientDetailsService {
*
* @param clientId
* @return
* @throws InvalidClientException
*/
@Override
@SneakyThrows
@Cacheable(value = SecurityConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
public ClientDetails loadClientByClientId(String clientId) throws InvalidClientException {
public ClientDetails loadClientByClientId(String clientId) {
return super.loadClientByClientId(clientId);
}
}

View File

@ -25,6 +25,7 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.R;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
@ -57,10 +58,10 @@ public class PigUserDetailsServiceImpl implements UserDetailsService {
*
* @param username 用户名
* @return
* @throws UsernameNotFoundException
*/
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
@SneakyThrows
public UserDetails loadUserByUsername(String username) {
Cache cache = cacheManager.getCache("user_details");
if (cache != null && cache.get(username) != null) {
return (PigUser) cache.get(username).get();

View File

@ -18,6 +18,8 @@ package com.pig4cloud.pig.common.security.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.CharsetUtil;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
@ -30,18 +32,17 @@ import java.io.IOException;
* 认证授权相关工具类
*/
@Slf4j
@UtilityClass
public class AuthUtils {
private static final String BASIC_ = "Basic ";
private final String BASIC_ = "Basic ";
/**
* 从header 请求中的clientId/clientsecect
*
* @param header header中的参数
* @throws RuntimeException if the Basic header is not present or is not valid
* Base64
*/
public static String[] extractAndDecodeHeader(String header)
throws IOException {
@SneakyThrows
public String[] extractAndDecodeHeader(String header) {
byte[] base64Token = header.substring(6).getBytes("UTF-8");
byte[] decoded;
@ -67,10 +68,9 @@ public class AuthUtils {
*
* @param request
* @return
* @throws IOException
*/
public static String[] extractAndDecodeHeader(HttpServletRequest request)
throws IOException {
@SneakyThrows
public String[] extractAndDecodeHeader(HttpServletRequest request) {
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
if (header == null || !header.startsWith(BASIC_)) {

View File

@ -40,7 +40,7 @@ public class SecurityUtils {
/**
* 获取Authentication
*/
public static Authentication getAuthentication() {
public Authentication getAuthentication() {
return SecurityContextHolder.getContext().getAuthentication();
}

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-common</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-config</artifactId>

View File

@ -2,7 +2,7 @@
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai

View File

@ -10,7 +10,7 @@ security:
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai

View File

@ -9,7 +9,7 @@ security:
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai

View File

@ -2,7 +2,7 @@ spring:
# 数据源
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-eureka</artifactId>

View File

@ -21,6 +21,7 @@ package com.pig4cloud.pig.eureka.security;
* @date 2019/2/1
*/
import lombok.SneakyThrows;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@ -28,7 +29,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
@SneakyThrows
protected void configure(HttpSecurity http) {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/actuator/**").permitAll()

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-gateway</artifactId>
@ -54,7 +54,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
</dependencies>

View File

@ -15,6 +15,8 @@ spring:
service-id: pig-config
profiles:
active: dev
main:
allow-bean-definition-overriding: true
# 注册中心
eureka:

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-upms-api</artifactId>
@ -35,7 +35,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
</dependencies>
</project>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-upms-biz</artifactId>
@ -34,19 +34,19 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--日志处理-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-log</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--配置中心客户端-->
<dependency>

View File

@ -15,6 +15,8 @@ spring:
service-id: pig-config
profiles:
active: dev
main:
allow-bean-definition-overriding: true
# 注册中心配置
eureka:
instance:

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-upms</artifactId>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-codegen</artifactId>
@ -50,13 +50,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
<!--代码生成模板引擎-->
<dependency>

View File

@ -23,6 +23,7 @@ import com.pig4cloud.pig.codegen.entity.GenConfig;
import com.pig4cloud.pig.codegen.service.SysGeneratorService;
import com.pig4cloud.pig.common.core.util.R;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@ -55,7 +56,8 @@ public class SysGeneratorController {
* 生成代码
*/
@PostMapping("/code")
public void code(@RequestBody GenConfig genConfig, HttpServletResponse response) throws IOException {
@SneakyThrows
public void code(@RequestBody GenConfig genConfig, HttpServletResponse response) {
byte[] data = sysGeneratorService.generatorCode(genConfig);
response.reset();

View File

@ -25,6 +25,7 @@ import com.pig4cloud.pig.codegen.entity.GenConfig;
import com.pig4cloud.pig.codegen.entity.TableEntity;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.exception.CheckedException;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
@ -49,6 +50,7 @@ import java.util.zip.ZipOutputStream;
* @date 2019/2/1
*/
@Slf4j
@UtilityClass
public class GenUtils {
private static final String ENTITY_JAVA_VM = "Entity.java.vm";
@ -62,7 +64,7 @@ public class GenUtils {
private static final String API_JS_VM = "api.js.vm";
private static final String CRUD_JS_VM = "crud.js.vm";
private static List<String> getTemplates() {
private List<String> getTemplates() {
List<String> templates = new ArrayList<>();
templates.add("template/Entity.java.vm");
templates.add("template/Mapper.java.vm");
@ -81,7 +83,7 @@ public class GenUtils {
/**
* 生成代码
*/
public static void generatorCode(GenConfig genConfig, Map<String, String> table,
public void generatorCode(GenConfig genConfig, Map<String, String> table,
List<Map<String, String>> columns, ZipOutputStream zip) {
//配置信息
Configuration config = getConfig();
@ -210,14 +212,14 @@ public class GenUtils {
/**
* 列名转换成Java属性名
*/
private static String columnToJava(String columnName) {
private String columnToJava(String columnName) {
return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
}
/**
* 表名转换成Java类名
*/
private static String tableToJava(String tableName, String tablePrefix) {
private String tableToJava(String tableName, String tablePrefix) {
if (StringUtils.isNotBlank(tablePrefix)) {
tableName = tableName.replace(tablePrefix, "");
}
@ -227,7 +229,7 @@ public class GenUtils {
/**
* 获取配置信息
*/
private static Configuration getConfig() {
private Configuration getConfig() {
try {
return new PropertiesConfiguration("generator.properties");
} catch (ConfigurationException e) {
@ -238,7 +240,7 @@ public class GenUtils {
/**
* 获取文件名
*/
private static String getFileName(String template, String className, String packageName, String moduleName) {
private String getFileName(String template, String className, String packageName, String moduleName) {
String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator;
if (StringUtils.isNotBlank(packageName)) {
packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;

View File

@ -15,7 +15,8 @@ spring:
discovery:
enabled: true
service-id: pig-config
main:
allow-bean-definition-overriding: true
# 注册中心配置
eureka:
instance:

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-monitor</artifactId>

View File

@ -17,6 +17,7 @@
package com.pig4cloud.pig.monitor.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@ -37,7 +38,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
}
@Override
protected void configure(HttpSecurity http) throws Exception {
@SneakyThrows
protected void configure(HttpSecurity http) {
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");

View File

@ -15,7 +15,8 @@ spring:
discovery:
enabled: true
service-id: pig-config
main:
allow-bean-definition-overriding: true
# 注册中心配置
eureka:
instance:

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>pig-visual</artifactId>
<groupId>com.pig4cloud</groupId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -15,6 +15,8 @@ spring:
discovery:
enabled: true
service-id: pig-config
main:
allow-bean-definition-overriding: true
# 注册中心配置
eureka:
instance:

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</parent>
<artifactId>pig-visual</artifactId>

22
pom.xml
View File

@ -21,25 +21,26 @@
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<url>https://www.pig4cloud.com</url>
<properties>
<spring-boot.version>2.0.8.RELEASE</spring-boot.version>
<spring-cloud.version>Finchley.SR3</spring-cloud.version>
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
<spring-platform.version>Cairo-SR7</spring-platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring-boot-admin.version>2.0.5</spring-boot-admin.version>
<spring-boot-admin.version>2.1.3</spring-boot-admin.version>
<hutool.version>4.5.0</hutool.version>
<mybatis-plus.version>3.1.0</mybatis-plus.version>
<kaptcha.version>0.0.9</kaptcha.version>
<velocity.version>1.7</velocity.version>
<jasypt.version>2.1.0</jasypt.version>
<security.oauth.version>2.3.3.RELEASE</security.oauth.version>
<security.oauth.version>2.3.5.RELEASE</security.oauth.version>
<security.oauth.auto.version>2.1.2.RELEASE</security.oauth.auto.version>
<jackson.modules>2.9.8</jackson.modules>
<!--zipkin2.12.x需要此版本jooq-->
<jooq.version>3.11.9</jooq.version>
@ -138,6 +139,17 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!--稳定版本替代spring security bom内置-->
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${security.oauth.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>${security.oauth.auto.version}</version>
</dependency>
<!--jackson模块-->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>