Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

java spring boot把一个类赋值给另一个类的属性,通过属性访问不了方法是怎么回事啊?

image

然后我控制器定义

@Autowired
private DService dservice;

这样使用

image


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

应该是方法访问权限问题,也就是countselectAll方法在你的控制器中无法访问到

两种可能吧

  1. 也许countselectAll都是private修饰符的方法
  2. 也许countselectAll是没有修饰符或者是protected修饰符的方法,并且控制器类和你的PlusServiceTKService不在同一个包

这个问题不是spring boot的知识点,是java基础知识哈,之后可以再去做了解哈java的访问权限


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...