如何修复Springboot应用程序中的白色错误页面?

时间:2019-06-07 04:47:43

标签: java spring-boot

我正在尝试运行一个小型的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";
    }
}

我要去哪里错误的人可以建议我吗?

0 个答案:

没有答案