Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://dimitri.codes/bundling-react-spring-boot/ #132

Open
utterances-bot opened this issue Nov 9, 2022 · 3 comments
Open

https://dimitri.codes/bundling-react-spring-boot/ #132

utterances-bot opened this issue Nov 9, 2022 · 3 comments
Labels
type: comments Issue automatically generated for comments

Comments

@utterances-bot
Copy link

Bundling your React app with Spring boot | Dimitri's tutorials

In this tutorial I'll show you how you can bundle your React app together with Spring boot.

https://dimitri.codes/bundling-react-spring-boot/

Copy link

pyofori commented Nov 9, 2022

Hello. Nice and informative article.
I'm facing a little bit of an issue, I guess because of the spring boot version I'm using.
This line 'registry.addViewController("/{x:^(?!api$).*$}/**/{y[\w\-]+}").setViewName("forward:/index.html");)' causes an error:

Error creating bean with name 'viewControllerHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.web.util.pattern.PatternParseException: No more pattern data allowed after {...} or ** pattern element
Caused by: org.springframework.web.util.pattern.PatternParseException: No more pattern data allowed after {
...} or ** pattern element

@g00glen00b g00glen00b added the type: comments Issue automatically generated for comments label Nov 10, 2022
@g00glen00b
Copy link
Owner

@pyofori That's true, this approach no longer works in the newest Spring Boot versions. Nowadays I usually write a custom filter in my backend. For example NotFoundIndexFilter. What this filter does is that each time a webpage is requested that is not containing our API-path, it's returning the index-page. The method I use for detecting if a webpage is requested is by checking if the Accept header contains text/html.

I'm updating the tutorial right now with new information because nowadays I also prefer putting the frontend-resources in its own JAR and including that JAR as a dependency in my backend-project.

@pyofori
Copy link

pyofori commented Nov 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: comments Issue automatically generated for comments
Projects
None yet
Development

No branches or pull requests

3 participants