代码严谨处理:解决部分用户反馈Cannot invoke "org.jeecg.common.api.CommonAPI.queryUserRolesById(String)" because "this.commonAPI" is null

pull/8569/head
JEECG 2025-07-01 09:24:04 +08:00
parent 6c24b3cf30
commit e8ad887096
1 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,8 @@ public class LowCodeModeInterceptor implements HandlerInterceptor {
@Resource
private JeecgBaseConfig jeecgBaseConfig;
@Autowired
@Autowired(required = false)
private CommonAPI commonAPI;
/**
@ -62,6 +63,9 @@ public class LowCodeModeInterceptor implements HandlerInterceptor {
if (jeecgBaseConfig == null) {
jeecgBaseConfig = SpringContextUtils.getBean(JeecgBaseConfig.class);
}
if (commonAPI == null) {
commonAPI = SpringContextUtils.getBean(CommonAPI.class);
}
if (jeecgBaseConfig.getFirewall()!=null && LowCodeModeInterceptor.LOW_CODE_MODE_PROD.equals(jeecgBaseConfig.getFirewall().getLowCodeMode())) {
String requestURI = request.getRequestURI().substring(request.getContextPath().length());