Whitelabel Error Page

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Aug 09 11:02:44 CST 2017
There was an unexpected error (type=Not Found, status=404).
No message available

Whitelabel Error Page_第1张图片

解析:404错误是由于访问路径不正确导致的。

源码查看:

package org.sang;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class TestSpringbootApplication {

   public static void main(String[] args) {

      SpringApplication.run(TestSpringbootApplication.class, args);
   }

   @RequestMapping(value="/aaa",produces="text/plain;charset=UTF-8")
   String sayHello(){
      return "hello world";
   }
}

properties配置如下:

Whitelabel Error Page_第2张图片

正确的访问形式: localhost:8081/helloboot/aaa

Whitelabel Error Page_第3张图片

访问路径组织: localhost:server.port(8081)/server.context-path(/helloboot)/RequestMapping(value=”/aaa”,)

你可能感兴趣的:(spring-boot)