The problem stems from a client’s own package framework, a Spring Boot project adding some custom configuration of the framework. I was devastated to get the frame at first, because it was still floating wrong. And the documentation is not detailed at all.
Sure enough, after spending a few minutes getting the project started, the static resources on the page didn’t load in. And an error is reported
401 Authentication FailedCopy the code
Looking at the code, it is clear that this is a bug defined by the framework itself.
But what is this authentication failure? I have opened the permission of that page according to the document, and the error when closing the permission is this
410 Unauthorized access is prohibitedCopy the code
This is interesting because I can’t find the error message at all.
Debug to see why this error message is reported.
And it turns out to be a mistake because
No handler mapping for xxx
Copy the code
I have never encountered static resource reporting error. I’ve gone through all the custom parts of the framework, and there’s absolutely no place for this to happen.
Since there is no code configuration for this, there must be some configuration for application.yml. Sure enough, I saw it
spring
resources:
add-mappings: false
Copy the code
My experience tells me it’s him. Change it to true. Problem solved
The reason is that because this is set to false, the addResourceHandlers method for WebMvcConfigurer returns directly, so there are no handlers to handle static resources.