Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k 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 OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...