我写了这个小代码来创建一个Spring Web应用程序。当我编译该代码时,它给了我“找不到符号”错误。我有正确声明和导入的类,但似乎无法解决它。该代码也不会编译。请帮助
package com.homework3.cis3368.Main.Controller;
import com.homework3.cis3368.Main.Models.ZooManagementRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class MainController {
@Autowired
ZooManagementRepo zooRepo;
@RequestMapping("/")
public ModelAndView homepage(){
ModelAndView home = new ModelAndView("index");
home.addObject("list", zooRepo.findAll());
return home;
}
}
这些是我得到的错误:
Error:(4, 41) java: cannot find symbol
symbol: class ZooManagementRepo
location: package com.homework3.cis3368.Main.Models
Error:(15, 5) java: cannot find symbol
symbol: class ZooManagementRepo
location: class com.homework3.cis3368.Main.Controller.MainController
项目结构如下
main
java
com.homework3.cis3368.Main
Controller (package)
MainController
Models (package)
ZooManagement
ZooManagementRepo(interface file)
Homework3Application