@AllArgsConstructor作用
·
@AllArgsConstructor 是lombok中的注解,作用在类上;
使用后添加一个构造函数,该构造函数含有所有已声明字段属性参数;
@Autowired和@resource可以用它来代替
@Api(tags = "微信用户标签")
@RestController
@AllArgsConstructor
@RequestMapping("/wxusertags")
public class WxUserTagsCtrl extends BaseFragment {
private final WxMpService wxService;
private final WxUserService wxUserService;
private final WxConfigService wxConfigService;
}
使用注意事项:
目前发现的已经BUG:
1、配置文件参数自动装配不管用,而且会起冲突
例如:
public class CodeFragment extends MaBaseFragment {
@Autowired
private WeixinOpenService weixinOpenService;
@Value("${icrm.domain}")
private String domain;
}
所以当遇到这种需求时候就这样写 @AllArgsConstructor 改成 @RequiredArgsConstructor 再把能自动装配的前面加final
@Slf4j
@RestController
//@AllArgsConstructor
@RequiredArgsConstructor
@RequestMapping("/user")
@Api(tags="账套用户增删服务",description = "")
public class SysUserPullCtrl extends ApiFrag {
@Value("${custom.tenantCode}")
private String tenantCode;
private final ISysUserPullService userPullService;
private final ISysTenantUserService tenantUserService;
private final ISysTenantUserApplyService tenantUserApplyService;
private final ISysUserService userservice;
private final ISysTenantService tenantService;
更多推荐
已为社区贡献6条内容
所有评论(0)