处理循环依赖问题

This commit is contained in:
wanggeng 2022-08-08 22:09:18 +08:00
parent 596fe32678
commit 84be61beae
9 changed files with 19 additions and 8 deletions

View File

@ -21,6 +21,7 @@ import ink.wgink.util.request.RequestUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -47,6 +48,7 @@ public class AppSignServiceImpl extends BaseAppSignService implements IAppSignSe
private IAppVersionService appVersionService; private IAppVersionService appVersionService;
@Autowired @Autowired
private PasswordEncoder passwordEncoder; private PasswordEncoder passwordEncoder;
@Lazy
@Autowired @Autowired
private IUserService userService; private IUserService userService;
@Autowired(required = false) @Autowired(required = false)

View File

@ -9,6 +9,7 @@ import ink.wgink.service.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
@ -55,12 +56,11 @@ public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigur
private IUserService userService; private IUserService userService;
@Autowired @Autowired
private OAuth2ClientDetailsServiceImpl oAuth2ClientDetailsService; private OAuth2ClientDetailsServiceImpl oAuth2ClientDetailsService;
@Lazy
@Autowired @Autowired
private OAuth2ClientTokenServiceImpl oAuth2ClientTokenService; private OAuth2ClientTokenServiceImpl oAuth2ClientTokenService;
@Autowired @Autowired
private AuthenticationManager authenticationManager; private AuthenticationManager authenticationManager;
@Autowired
private PasswordEncoder passwordEncoder;
@Override @Override

View File

@ -14,6 +14,7 @@ import ink.wgink.service.department.service.IDepartmentAdjustmentService;
import ink.wgink.service.department.service.IDepartmentUserAdjustmentService; import ink.wgink.service.department.service.IDepartmentUserAdjustmentService;
import ink.wgink.service.user.service.IUserService; import ink.wgink.service.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
@ -35,6 +36,7 @@ public class DepartmentAdjustmentServiceImpl extends DefaultBaseService implemen
@Autowired @Autowired
private IDepartmentAdjustmentDao departmentAdjustmentDao; private IDepartmentAdjustmentDao departmentAdjustmentDao;
@Lazy
@Autowired @Autowired
private IUserService userService; private IUserService userService;
@Autowired @Autowired

View File

@ -36,6 +36,7 @@ import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.string.WStringUtil; import ink.wgink.util.string.WStringUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -58,6 +59,7 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
@Autowired @Autowired
private IDepartmentDao departmentDao; private IDepartmentDao departmentDao;
@Autowired @Autowired
@Lazy
private IDepartmentUserService departmentUserService; private IDepartmentUserService departmentUserService;
@Autowired @Autowired
private IDepartmentAdjustmentService departmentAdjustmentService; private IDepartmentAdjustmentService departmentAdjustmentService;

View File

@ -27,6 +27,7 @@ import ink.wgink.util.thread.CachedThreadPoolUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
@ -50,6 +51,7 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
private IDepartmentService departmentService; private IDepartmentService departmentService;
@Autowired @Autowired
private IDepartmentAdjustmentService departmentAdjustmentService; private IDepartmentAdjustmentService departmentAdjustmentService;
@Lazy
@Autowired @Autowired
private IUserBaseService userBaseService; private IUserBaseService userBaseService;
@Autowired(required = false) @Autowired(required = false)

View File

@ -18,6 +18,7 @@ import ink.wgink.service.group.service.IGroupUserService;
import ink.wgink.util.thread.CachedThreadPoolUtil; import ink.wgink.util.thread.CachedThreadPoolUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,8 +41,10 @@ public class GroupUserServiceImpl extends DefaultBaseService implements IGroupUs
@Autowired @Autowired
private IGroupUserDao groupUserDao; private IGroupUserDao groupUserDao;
@Lazy
@Autowired @Autowired
private IUserBaseService userBaseService; private IUserBaseService userBaseService;
@Lazy
@Autowired @Autowired
private IGroupService groupService; private IGroupService groupService;
@Autowired(required = false) @Autowired(required = false)

View File

@ -18,6 +18,7 @@ import ink.wgink.service.position.service.IPositionUserService;
import ink.wgink.util.thread.CachedThreadPoolUtil; import ink.wgink.util.thread.CachedThreadPoolUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,8 +41,10 @@ public class PositionUserServiceImpl extends DefaultBaseService implements IPosi
@Autowired @Autowired
private IPositionUserDao positionUserDao; private IPositionUserDao positionUserDao;
@Lazy
@Autowired @Autowired
private IUserBaseService userBaseService; private IUserBaseService userBaseService;
@Lazy
@Autowired @Autowired
private IPositionService positionService; private IPositionService positionService;
@Autowired(required = false) @Autowired(required = false)

View File

@ -12,7 +12,6 @@ import ink.wgink.service.department.service.IDepartmentService;
import ink.wgink.service.department.service.IDepartmentUserService; import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.service.role.service.IRoleDepartmentUserService; import ink.wgink.service.role.service.IRoleDepartmentUserService;
import ink.wgink.service.role.service.IRoleUserService; import ink.wgink.service.role.service.IRoleUserService;
import ink.wgink.service.user.service.IUserService;
import ink.wgink.util.ArrayListUtil; import ink.wgink.util.ArrayListUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -35,8 +34,6 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
@Autowired @Autowired
private IRoleUserService roleUserService; private IRoleUserService roleUserService;
@Autowired @Autowired
private IUserService userService;
@Autowired
private IDepartmentService departmentService; private IDepartmentService departmentService;
@Autowired @Autowired
private IDepartmentUserService departmentUserService; private IDepartmentUserService departmentUserService;

View File

@ -15,7 +15,6 @@ import ink.wgink.pojo.dtos.role.RoleUserDTO;
import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.pos.RolePO; import ink.wgink.pojo.pos.RolePO;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.service.role.dao.IRoleUserDao; import ink.wgink.service.role.dao.IRoleUserDao;
import ink.wgink.service.role.service.IRoleService; import ink.wgink.service.role.service.IRoleService;
import ink.wgink.service.role.service.IRoleUserService; import ink.wgink.service.role.service.IRoleUserService;
@ -23,6 +22,7 @@ import ink.wgink.service.user.pojo.pos.UserPO;
import ink.wgink.util.thread.CachedThreadPoolUtil; import ink.wgink.util.thread.CachedThreadPoolUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
@ -42,12 +42,12 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
@Autowired @Autowired
private IRoleUserDao roleUserDao; private IRoleUserDao roleUserDao;
@Lazy
@Autowired @Autowired
private IRoleService roleService; private IRoleService roleService;
@Lazy
@Autowired @Autowired
private IUserBaseService userBaseService; private IUserBaseService userBaseService;
@Autowired
private IDepartmentUserService departmentUserService;
@Autowired(required = false) @Autowired(required = false)
private IRoleUserSaveAfterHandler roleUserSaveAfterHandler; private IRoleUserSaveAfterHandler roleUserSaveAfterHandler;
@Autowired(required = false) @Autowired(required = false)