Java Spring引导服务没有针对错误的显式映射
我创建了一个简单的spring启动项目和一个react应用程序。 在src/main/java/com/example/i中有DemoApplication.java和DemoController.java: 演示应用程序:Java Spring引导服务没有针对错误的显式映射,java,spring,reactjs,spring-boot,Java,Spring,Reactjs,Spring Boot,我创建了一个简单的spring启动项目和一个react应用程序。 在src/main/java/com/example/i中有DemoApplication.java和DemoController.java: 演示应用程序: package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplicat
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
演示控制器:
package tutorial;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class DemoController {
@RequestMapping(value = "/")
public String index() {
return "index.html";
}
}
在src/main/resources/static/index.html中:
<!DOCTYPE html>
<html>
<head>
<title>React + Spring</title>
</head>
<body>
</body>
</html>
检查此项-可能的重复性将index.html放入静态文件夹可能会产生重复。
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Apr 27 23:30:46 EEST 2017
There was an unexpected error (type=Not Found, status=404).
No message available