I'm trying to create a simple web application using create-react-app and Spring Boot, but spring can't find index.html in resources.
React's build folder is copied to target by maven-resources-plugin:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
...
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
...
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/app/build</directory>
<filtering>true</filtering>
</resource>
</resources>
...
</plugin>
This is my project structure:
Controller:
@Controller
public class BasicController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "index";
}
}
Get request to localhost:8080 returns 404. Could you please point me where am i mistaken.
UPDATE:
Managed to make it working by changing React's build output directory in maven plugin to
${basedir}/src/main/resources/META-INF/resources
and return "index" to return index.html.

