场景:springboot整合springcloud的服务注册eureka ,在测试服务客户端时,打开页面报错
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Dec 14 16:35:25 CST 2016
There was an unexpected error (type=Not Found, status=404).
No message available
解决办法:启动类在包的的最外层,包含左右的子包,并且在启动类上添加注解
@ComponentScan(basePackages = {"com.hdph.eurekaclient.*"}) 扫描的包,
pom.xml中引入web
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
别因为粗心落下controller 是否添加注解@RestController
重新运行结果