diff --git a/opensabre-base-dependencies/pom.xml b/opensabre-base-dependencies/pom.xml index 4bc2efd..bc473c1 100644 --- a/opensabre-base-dependencies/pom.xml +++ b/opensabre-base-dependencies/pom.xml @@ -24,10 +24,10 @@ 2.7.5 1.4.13 - 2.7.5 - 2021.0.4 - 2021.0.4.0 - 2.7.5 + 2.7.18 + 2021.0.9 + 2021.0.5.0 + 2.7.18 2.7.5 1.6.12 2.2.4 @@ -38,16 +38,16 @@ 2.11.1 3.12.0 5.8.18 - 5.3.23 + 5.3.31 1.1.2 31.1-jre - 2.13.4.2 - 2.13.4 + 2.13.5 + 2.13.5 3.0.5 5.9.1 - 5.3.23 - 2.7.5 + 5.3.31 + 2.7.18 5.2.1 diff --git a/opensabre-starter-boot/src/main/resources/opensabre-boot.properties b/opensabre-starter-boot/src/main/resources/opensabre-boot.properties index 5e9a8c5..0d225a9 100644 --- a/opensabre-starter-boot/src/main/resources/opensabre-boot.properties +++ b/opensabre-starter-boot/src/main/resources/opensabre-boot.properties @@ -12,6 +12,15 @@ spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8000/oaut server.shutdown=graceful #==============敏感信息加密配置===============# jasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD:Pa55w0rd@opensabre} +#==============管理端点===============# +#启用配置里的info开头的变量 +management.info.env.enabled=true +info.name=${spring.application.name} +info.version=${application.formatted-version} +info.java.version=${java.version} +info.opensabre.version=${opensabre.version} +info.opensabre.cloud.az=${opensabre.cloud.az} +info.opensabre.cloud.region=${opensabre.cloud.region} #==============脱敏===============# opensabre.sensitive.log.enabled=false opensabre.sensitive.log.rules=mobile,idCard,phone diff --git a/opensabre-starter-persistence/pom.xml b/opensabre-starter-persistence/pom.xml index 9173581..80dda23 100644 --- a/opensabre-starter-persistence/pom.xml +++ b/opensabre-starter-persistence/pom.xml @@ -30,6 +30,10 @@ + + io.github.opensabre + opensabre-starter-boot + org.projectlombok diff --git a/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/exception/SentinelExceptionHandlerAdvice.java b/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/exception/SentinelExceptionHandlerAdvice.java index 43f0347..f9aeec6 100644 --- a/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/exception/SentinelExceptionHandlerAdvice.java +++ b/opensabre-starter-rpc/src/main/java/io/github/opensabre/rpc/sentinel/exception/SentinelExceptionHandlerAdvice.java @@ -10,7 +10,9 @@ import io.github.opensabre.common.core.exception.SystemErrorType; import lombok.extern.slf4j.Slf4j; import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; /** @@ -22,18 +24,21 @@ public class SentinelExceptionHandlerAdvice { @ExceptionHandler(BlockException.class) + @ResponseStatus(HttpStatus.TOO_MANY_REQUESTS) public Result blockException(BlockException e) { log.error("block exception:{}", e.getRule()); return Result.fail(SystemErrorType.SYSTEM_BUSY); } @ExceptionHandler(FlowException.class) + @ResponseStatus(HttpStatus.TOO_MANY_REQUESTS) public Result flowException(FlowException e) { log.error("flow exception:{}", e.getRule()); return Result.fail(SystemErrorType.SYSTEM_BUSY); } @ExceptionHandler(DegradeException.class) + @ResponseStatus(HttpStatus.TOO_MANY_REQUESTS) public Result degradeException(DegradeException e) { log.error("degrade exception:{}", e.getRule()); return Result.fail(SystemErrorType.SYSTEM_BUSY); diff --git a/opensabre-web/src/main/java/io/github/opensabre/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java b/opensabre-web/src/main/java/io/github/opensabre/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java index 9fd2093..4262872 100644 --- a/opensabre-web/src/main/java/io/github/opensabre/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java +++ b/opensabre-web/src/main/java/io/github/opensabre/common/web/exception/DefaultGlobalExceptionHandlerAdvice.java @@ -7,6 +7,7 @@ import org.springframework.core.annotation.Order; import org.springframework.http.HttpStatus; import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.HttpMediaTypeNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MissingServletRequestParameterException; @@ -25,31 +26,39 @@ public class DefaultGlobalExceptionHandlerAdvice { @ExceptionHandler(value = {MissingServletRequestParameterException.class}) public Result missingServletRequestParameterException(MissingServletRequestParameterException ex) { - log.error("missing servlet request parameter exception:{}", ex.getMessage()); + log.warn("missing servlet request parameter exception:{}", ex.getMessage()); return Result.fail(SystemErrorType.ARGUMENT_NOT_VALID); } @ExceptionHandler(value = {MethodArgumentNotValidException.class}) public Result argumentInvalidException(MethodArgumentNotValidException ex) { - log.error("service exception:{}", ex.getMessage()); + log.warn("service exception:{}", ex.getMessage()); return Result.fail(SystemErrorType.ARGUMENT_NOT_VALID, ex.getBindingResult().getFieldError().getDefaultMessage()); } @ExceptionHandler(value = {HttpMessageNotReadableException.class}) public Result httpMessageConvertException(HttpMessageNotReadableException ex) { - log.error("http message convert exception:{}", ex.getMessage()); + log.warn("http message convert exception:{}", ex.getMessage()); return Result.fail(SystemErrorType.ARGUMENT_NOT_VALID, "数据解析错误:" + ex.getMessage()); } @ExceptionHandler(value = {MultipartException.class}) public Result uploadFileLimitException(MultipartException ex) { - log.error("upload file size limit:{}", ex.getMessage()); + log.warn("upload file size limit:{}", ex.getMessage()); return Result.fail(SystemErrorType.UPLOAD_FILE_SIZE_LIMIT); } @ExceptionHandler(value = {HttpRequestMethodNotSupportedException.class}) + @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) public Result notSupportedMethodException(HttpRequestMethodNotSupportedException ex) { - log.error("http request method not supported exception {}", ex.getMessage()); + log.warn("http request method not supported exception {}", ex.getMessage()); + return Result.fail(SystemErrorType.METHOD_NOT_SUPPORTED); + } + + @ExceptionHandler(value = {HttpMediaTypeNotSupportedException.class}) + @ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE) + public Result notSupportedMethodException(HttpMediaTypeNotSupportedException ex) { + log.warn("http request method not supported exception {}", ex.getMessage()); return Result.fail(SystemErrorType.METHOD_NOT_SUPPORTED); } diff --git a/pom.xml b/pom.xml index 27f6584..639aa84 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ 1.6.8 2.22.2 - 0.0.8 + 0.0.9