【JavaEE】关于SpringBoot启动出现Whitelabel Error Page错误
先来看一下第一次启动SpringBoot的目录结构以及indexController和Application的代码
此时输入http://localhost:8080/index启动会报下图的错误
仔细看两个类的包路径,发现他们是平级的
这个错误的问题在于,Application是所有类的入口类,换句话讲,他的类要包含所有子类
而我的controller类的包路径是:package com.example.controller
Application类的包路径为:package com.example.shopdemo
而修改方法就是要将Application类的包路径>其他类
将controller类的包路径改为:
package com.example.shopdemo.controller
这样在输入http://localhost:8080/index,就启动成功了