我正在尝试运行一个小型的spring boot项目,但是在这里我得到了白色错误页面。如何解决此问题?
SpringBootAnnotationApplication.java
=====================================
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"com.example.demo.controller"})
public class SpringBootAnnotationApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAnnotationApplication.class, args);
}
}
BootController.java
===================
@Controller
public class BootController {
@Autowired
private MyBean mybean;
@RequestMapping("/")
public String theHandler() {
return mybean.getMessage();
}
}
MyBean.java
===========
@Component
public class MyBean {
public String getMessage() {
return "message from my bean class";
}
}
我要去哪里错误的人可以建议我吗?