-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Information and doclink on routes not found error about known Spring …
…Boot Devtools issue (#655) Spring Boot Devtools issue (spring-projects/spring-boot#19543)
- Loading branch information
Johannes Eriksson
authored
Aug 26, 2020
1 parent
64b8d83
commit 7b684a4
Showing
2 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
vaadin-spring/src/main/java/com/vaadin/flow/spring/router/SpringRouteNotFoundError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.vaadin.flow.spring.router; | ||
|
||
import com.vaadin.flow.component.Html; | ||
import com.vaadin.flow.router.BeforeEnterEvent; | ||
import com.vaadin.flow.router.ErrorParameter; | ||
import com.vaadin.flow.router.NotFoundException; | ||
import com.vaadin.flow.router.RouteNotFoundError; | ||
|
||
public class SpringRouteNotFoundError extends RouteNotFoundError { | ||
@Override | ||
public int setErrorParameter(BeforeEnterEvent event, | ||
ErrorParameter<NotFoundException> parameter) { | ||
int retval = super.setErrorParameter(event, parameter); | ||
|
||
// Alert user about potential issue with Spring Boot Devtools losing | ||
// routes https://github.com/spring-projects/spring-boot/issues/19543 | ||
String customMessage = "<span>When using Spring Boot Devtools with " | ||
+ "automatic reload, please note that routes can sometimes be " | ||
+ "lost due to a <a href ='https://github.com/spring-projects/spring-boot/issues/19543'>" | ||
+ "compilation race condition</a>. See " | ||
+ "<a href='https://vaadin.com/docs/flow/workflow/setup-live-reload-springboot.html'>" | ||
+ "the documentation</a> for further workarounds and other " | ||
+ "live reload alternatives."; | ||
getElement().appendChild(new Html(customMessage).getElement()); | ||
|
||
return retval; | ||
} | ||
} |