是因为超类里的属性没有加上public关键字

解决方法: 超类和超类里的属性或者方法如果想被其他包下的方法调用,就必须全部加上public权限,即设置为公开访问

 

例:

 

@Controller
public class BaseController {

@Autowired
public AssetsService assetsService;
@Autowired
public ConfigLinuxService configLinuxService;
@Autowired
public ConfigWindowsService configWindowsService;
@Autowired
public XconfigLinuxService xconfigLinuxService;
@Autowired
public XconfigWindowsService xconfigWindowsService;
@Autowired
public ConfigWindowsWaiYunService configWindowsWaiYunService;

}

 

public class BaseUtil {

public AssetsService assetsService = (AssetsService) SpringContextUtil.getBean(AssetsService.class);
public ConfigLinuxService configLinuxService = (ConfigLinuxService) SpringContextUtil.getBean(ConfigLinuxService.class);
public ConfigWindowsService configWindowsService = (ConfigWindowsService) SpringContextUtil.getBean(ConfigWindowsService.class);
public XconfigLinuxService xconfigLinuxService = (XconfigLinuxService) SpringContextUtil.getBean(XconfigLinuxService.class);
public XconfigWindowsService xconfigWindowsService = (XconfigWindowsService) SpringContextUtil.getBean(XconfigWindowsService.class);

}