当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

SpringBootAngularHTML5

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 阮昊阳
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Build StatusBuild Status

NB: Older Spring Boot and Angular versions are available in branches.
This project is available in Kotlin too. Take a look at this repository.

Spring Boot 2.x and Angular 12.x with HTML 5 router

This project provides an example of an Angular single page application, served by Tomcat,configured with the html5 router. Some endpoints have Spring Webflux integration too.

The SinglePageAppConfig makes the magic here.

The base-href in configured by the ResourceResolver. It's generated from the value of the application's context-path at runtime when served by tomcat.

It's useful if you want to serve an Angular application with the html5 router, and avoid the dashed URL.

This html5 router mode makes pretty URL, but has a default : Refreshing pages (or accessing them directly) will give you a 404HTTP error if no RewriteRule is provided by the HTTP server that serves the application.

Handling the base-href dynamically can be tricky too. Here it's done once and for all by the ResourceResolver.

This project includes a custom HTTP interceptor. It's useful to show a loader during long HTTP requests for example.

To test the fully built project, run SpringBootAngularHTML5Application after an ./mvnw clean install -Pfront, and point your browser to http://localhost:10000/my-context/path.

If you want to play with the front part, go to the front folder and run yarn start or npm start. HTTP requests will be correctly proxyfied to your backend.

The front-end part has been scaffolded with angular-cli.

相关阅读

相关文章

相关问答

相关文档