Skip to content

Zero configuration single page app configuration for spring boot

License

Notifications You must be signed in to change notification settings

bgalek/spring-boot-starter-spa

Folders and files

NameName
Last commit message
Last commit date
Jan 27, 2025
Nov 3, 2024
Nov 3, 2024
Nov 3, 2024
Jun 23, 2020
Jun 23, 2020
Jun 23, 2020
Nov 3, 2024
Mar 17, 2025
Nov 3, 2024
Nov 3, 2024
Nov 3, 2024

Repository files navigation

Spring Boot Starter - Single Page App

Zero configuration single page app configuration for spring boot

Build Maven Central

Why?

Single Page Apps require one thing: return index.html on HTML request.

Sometimes it's wise to separate your apps (api backend & frontend backend + frontend) - but then you'll have to deal with versioning both aps in compatible way.

For simple use cases it's totally ok to have spring-boot serve your SPA application (build i.e. by webpack).

Spring-boot does not support this feature out of the box. I've found multiple workarounds (404 page filters, manual file checking etc.) and decided to make no-brainer library to handle this problem.

Usage

Add library dependency:

compile "com.github.bgalek.spring.boot:spring-boot-starter-spa:1.1.0"

Copy your frontend application to /public or /static folder during your app build phase.

Compatibility

This configuration won't affect your:

  • API calls (registered Controllers)
  • Existing static files