Spring Boot WebFlux remove Whitelabel - spring

I am testing the new WebFlux framework and I would like to remove the default error view (Whitelabel Error Page). I have noticed that the default server for this framework is Netty and that it seems not to respond to the old server.error.whitelabel.enabled=false.
Is there any other way or am I doing something wrong?

This is a bug and it will be fixed in Spring Boot 2.0.1.RELEASE, see gh-12520.
In the meantime, you could:
exclude completely the ErrorWebFluxAutoConfiguration if you don't want any Spring Boot error handling support
add a error template/static file in your application to override the default view
Note that once it's supported (and without applying the other options I've just listed), your application will just send a raw HTTP error response (i.e. not a JSON response). Is that what you intend to have?

Related

Spring Reactive WebSocket does not come up when spring-web is present

I have an existing spring web application that uses spring-boot-starter-web; I have been planning to introduce reactive into this application. For a new feature that I am working, I have pulled in spring reactive web socket, configured and coded as specified in the spring doc; but unfortunately it does not work (got 404).
I tried a sample application and that works perfectly.
I used this one as my sample application.
I found that the sample application comes up on Netty, not on Tomcat. So I added spring-boot-starter-web to it, got the server to start in Tomcat and got the same 404 as I got in my application.
I also added TomcatRequestUpgradeStrategy unsuccessfully.
should I assume that spring-web and spring-webflux conflict with each other and I should go back to the regular websocket? Please advise.
Spring said that if both spring web and spring webflux present in the classpath; spring web kicks in and reactive websocket won't come up.
More details here: https://github.com/spring-projects/spring-boot/issues/23236

what is service url in spring starter project? Alternatives for default service url https://start.spring.io

I am new to Spring boot.
While creating a New Spring Starter project in STS there is a Service URL dropdown defaults to https://start.spring.io as given below.
I searched in stack overflow but didn't find any information about it.
What is the use of specifying this? Why it has been given as editable? Is there any alternative available instead of https://start.spring.io?
I noticed that tried with any other URL, it tries to parse as json and gives exception given below.
JSONException: A JSONObject text must begin with '{' at character 3
Need clarification, what is happening in background?
It is a simple client server architecture which various UI clients such as Spring Boot CLI , IDE or official web UI talk to the same backend HTTP API that actually generates the spring starter project.
The service URL is the URL of this HTTP API. Spring Team already deploy an official one at https://start.spring.io which you can simply use it.
But in case if you want to build your own customised version , you can checkout its source codes , modify according to your needs and deployed to your own server. Then change the service URL to your API server 's URL in order to use it.

Spring Data Rest links incorrect after upgrading to spring boot 2.1.0.RELEASE

After upgrading the spring boot starter parent from 2.0.6.RELEASE to 2.1.0.RELEASE, the links generated by spring data rest no longer have the host of the UI but instead have the host of the API microservice. Is there an application property or setting that needs to be added.
I compared the request headers of the request when using each of the versions and they haven't changed while checking if may have been causing the issue.
I noticed that in the 'getting started' guide for rest hateoas
Spring HATEOAS respects various X-FORWARDED- headers
But I never set those headers in the previous version. Should those be added.

Spring Boot app, content served and app functioning fine but getting a lot of 'Did not find handler method for *...' spam

I've got a few Spring Boot web apps that are functioning fine, but I get a ton of spam related to 'Did not find handler method for X' since using Spring Boot 2.0.4. I get it for static content as well. This is a Spring Boot 2.0.4/Thymeleaf app. It's not affecting the functionality of the app at all as all content is being served but it's quite annoying. Any ideas?
I was able to filter it out through logging.level.org.springframework.boot=INFO.

Spring Security java config : intercept the wrong urls and redirect to an error page

I'm woking on a spring web application lately, using spring security, hibernate and thymeleaf.
I opted for a no XML approach.
I want to intercept the wrong urls that the user might insert and redirect him to a custom error page( and not the default glassfish error page), as well as the 505 error (when there is a problem with the views ) so my question is, what to add and where ?
PS:
i have a #ControllerAdvice controller

Resources