在启动springboot中遇到了这样的问题
2022-09-21 02:07:19.012 INFO 2200 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-09-21 02:07:19.019 INFO 2200 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-21 02:07:19.035 ERROR 2200 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Field cate in cn.edu.neu.hellospringboot.controller.HelloController required a bean of type 'cn.edu.neu.hellospringboot.model.Categray' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'cn.edu.neu.hellospringboot.model.Categray' in your configuration.
Process finished with exit code 1
启动代码截图如下:
package cn.edu.neu.hellospringboot.controller;
import cn.edu.neu.hellospringboot.config.MyService;
import cn.edu.neu.hellospringboot.model.Categray;
import cn.edu.neu.hellospringboot.model.Person;
import cn.edu.neu.hellospringboot.model.User;
import cn.edu.neu.hellospringboot.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@Autowired
public User user;
@Autowired
public Categray cate;
@Autowired
public Person person;
@Autowired
public HelloService service;
@Autowired
public MyService myService;
@RequestMapping("/")
public String hello(){
String result=service.getData();
myService.testMyservice();
System.out.println(user);
// System.out.println(cate);
System.out.println(person);
return result+user.getUser_name();
// return "Hello SpringBoot!";
}
}
求解答!