👎 删除dubbo 修复本地域名
This commit is contained in:
@@ -59,12 +59,12 @@
|
|||||||
<artifactId>resilience4j-ratelimiter</artifactId>
|
<artifactId>resilience4j-ratelimiter</artifactId>
|
||||||
<scope>provided</scope> <!-- 设置为 provided,主要是 GlobalExceptionHandler 使用 -->
|
<scope>provided</scope> <!-- 设置为 provided,主要是 GlobalExceptionHandler 使用 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<!-- <groupId>org.apache.dubbo</groupId>-->
|
||||||
<artifactId>dubbo</artifactId>
|
<!-- <artifactId>dubbo</artifactId>-->
|
||||||
<version>3.0.9</version>
|
<!-- <version>3.0.9</version>-->
|
||||||
<scope>compile</scope>
|
<!-- <scope>compile</scope>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -17,7 +17,7 @@ import io.github.resilience4j.ratelimiter.RequestNotPermitted;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.dubbo.rpc.RpcException;
|
//import org.apache.dubbo.rpc.RpcException;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
@@ -96,10 +96,10 @@ public class GlobalExceptionHandler {
|
|||||||
return accessDeniedExceptionHandler(request, (AccessDeniedException) ex);
|
return accessDeniedExceptionHandler(request, (AccessDeniedException) ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex instanceof RpcException){
|
// if (ex instanceof RpcException){
|
||||||
log.error("dubbo错误", ex);
|
// log.error("dubbo错误", ex);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
return defaultExceptionHandler(request, ex);
|
return defaultExceptionHandler(request, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.server;
|
package cn.iocoder.yudao.server;
|
||||||
|
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.system.ApplicationHome;
|
import org.springframework.boot.system.ApplicationHome;
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ dubbo:
|
|||||||
bxg:
|
bxg:
|
||||||
shop:
|
shop:
|
||||||
# API_URL: http://192.168.10.113:48080/bxgApp
|
# API_URL: http://192.168.10.113:48080/bxgApp
|
||||||
API_URL: http://45288535.r5.cpolar.top
|
API_URL: http://yudao.test.yixinhuixiang.com
|
||||||
SITE_URL: http://192.168.10.113:48080/bxgApp
|
SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||||
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
|
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||||
ADMIN_API_URL: http://192.168.10.113:48080/bxg
|
ADMIN_API_URL: http://192.168.10.113:48080/bxg
|
||||||
|
|||||||
@@ -1,101 +1,101 @@
|
|||||||
/**
|
///**
|
||||||
* Copyright (C) 2018-2022
|
// * Copyright (C) 2018-2022
|
||||||
* All rights reserved, Designed By www.yixiang.co
|
// * All rights reserved, Designed By www.yixiang.co
|
||||||
|
//
|
||||||
*/
|
// */
|
||||||
package co.yixiang.app.common.aspect;
|
//package co.yixiang.app.common.aspect;
|
||||||
|
//
|
||||||
import co.yixiang.app.common.bean.LocalUser;
|
//import co.yixiang.app.common.bean.LocalUser;
|
||||||
import co.yixiang.logging.domain.Log;
|
//import co.yixiang.logging.domain.Log;
|
||||||
import co.yixiang.logging.service.LogService;
|
//import co.yixiang.logging.service.LogService;
|
||||||
import co.yixiang.utils.RequestHolder;
|
//import co.yixiang.utils.RequestHolder;
|
||||||
import co.yixiang.utils.StringUtils;
|
//import co.yixiang.utils.StringUtils;
|
||||||
import co.yixiang.utils.ThrowableUtil;
|
//import co.yixiang.utils.ThrowableUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
//import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
//import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.AfterThrowing;
|
//import org.aspectj.lang.annotation.AfterThrowing;
|
||||||
import org.aspectj.lang.annotation.Around;
|
//import org.aspectj.lang.annotation.Around;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
//import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
//import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import javax.servlet.http.HttpServletRequest;
|
//import javax.servlet.http.HttpServletRequest;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author hupeng
|
// * @author hupeng
|
||||||
* @date 2018-11-24
|
// * @date 2018-11-24
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@Aspect
|
//@Aspect
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class AppLogAspect {
|
//public class AppLogAspect {
|
||||||
|
//
|
||||||
private final LogService logService;
|
// private final LogService logService;
|
||||||
|
//
|
||||||
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
// ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
||||||
|
//
|
||||||
public AppLogAspect(LogService logService) {
|
// public AppLogAspect(LogService logService) {
|
||||||
this.logService = logService;
|
// this.logService = logService;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 配置切入点
|
// * 配置切入点
|
||||||
*/
|
// */
|
||||||
@Pointcut("@annotation(co.yixiang.logging.aop.log.AppLog)")
|
// @Pointcut("@annotation(co.yixiang.logging.aop.log.AppLog)")
|
||||||
public void logPointcut() {
|
// public void logPointcut() {
|
||||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
// // 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
// * 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||||
*
|
// *
|
||||||
* @param joinPoint join point for advice
|
// * @param joinPoint join point for advice
|
||||||
*/
|
// */
|
||||||
@Around("logPointcut()")
|
// @Around("logPointcut()")
|
||||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
// public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
Object result;
|
// Object result;
|
||||||
currentTime.set(System.currentTimeMillis());
|
// currentTime.set(System.currentTimeMillis());
|
||||||
result = joinPoint.proceed();
|
// result = joinPoint.proceed();
|
||||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
|
// Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
|
||||||
currentTime.remove();
|
// currentTime.remove();
|
||||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||||
logService.saveApp(getUsername(),
|
// logService.saveApp(getUsername(),
|
||||||
StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint,
|
// StringUtils.getIp(RequestHolder.getHttpServletRequest()),joinPoint,
|
||||||
log,getUid());
|
// log,getUid());
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 配置异常通知
|
// * 配置异常通知
|
||||||
*
|
// *
|
||||||
* @param joinPoint join point for advice
|
// * @param joinPoint join point for advice
|
||||||
* @param e exception
|
// * @param e exception
|
||||||
*/
|
// */
|
||||||
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
// @AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
||||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
// public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||||
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
|
// Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
|
||||||
currentTime.remove();
|
// currentTime.remove();
|
||||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
// log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||||
logService.save(getUsername(),
|
// logService.save(getUsername(),
|
||||||
StringUtils.getIp(RequestHolder.getHttpServletRequest()),
|
// StringUtils.getIp(RequestHolder.getHttpServletRequest()),
|
||||||
(ProceedingJoinPoint)joinPoint, log,getUid());
|
// (ProceedingJoinPoint)joinPoint, log,getUid());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getUsername() {
|
// public String getUsername() {
|
||||||
try {
|
// try {
|
||||||
return LocalUser.getUser().getUsername();
|
// return LocalUser.getUser().getUsername();
|
||||||
}catch (Exception e){
|
// }catch (Exception e){
|
||||||
return "";
|
// return "";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Long getUid(){
|
// public Long getUid(){
|
||||||
try {
|
// try {
|
||||||
return LocalUser.getUser().getUid();
|
// return LocalUser.getUser().getUid();
|
||||||
}catch (Exception e){
|
// }catch (Exception e){
|
||||||
return 0L;
|
// return 0L;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user