0%

Simple Integration of Single Page App into Spring Boot

April 24, 2026

React

Springboot

1.

Example Frontend Repository

The following is a visualization tool of all commands, events and policies in a backend system:

2.

How does it work in Spring Boot

2.1.

How Spring Boot serves the React Endpoint

  • The react application is built into an index.html with several bundled files:

    These built files are relocated into

    src/main/resources/static/

    in a spring boot project

  • If our spring boot application can be accessed via the domain name some-domain.com, our react application will be available precisely at

    some-domain.com

2.2.

Routes for Data Fetching from the Same Origin

  • For the react app, in this line of App.tsx we fetch data from /api/commands/flow (hard-coded) and feed that data into our visualization component.

    This /api/commands/flow inside the react application will be resolved into

    some-domain.com/api/commands/flow

  • This is exactly how our react application is deployed and how it fetches data from the same origin: