I created a simple spring boot project and a react app. In src/main/java/com/example/ i have DemoApplication.java and DemoController.java:
DemoApplication:
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);
}
}
DemoController:
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";
}
}
In src/main/resources/static/index.html:
<!DOCTYPE html>
<html>
<head>
<title>React + Spring</title>
</head>
<body>
</body>
</html>
However when I start the server I see:
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