Closed ZZQ001010 closed 2 years ago
You are using @EnableWebMvc
which completely disables Boot’s auto-configuration. You are also defining a registration for the dispatcher servlet and static resource mappings yourself. Given that you’re configuring so much yourself, it’s hard to see where Spring Boot could be causing the problem.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
You can refer to https://docs.spring.io/spring-boot/docs/2.6.5/reference/htmlsingle/#application-properties.web.spring.web.resources.static-locations to configure static resources. Use @ControllerAdvice to handle global exceptions.
Modifying the configuration "spring.mvc.pathmatch.matching-strategy=ant_path_matcher" can solve this problem.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Hi, not sure it's 100% linked with your case but it's close enough to give you the information.
I had an issue upgrading 2.5.12 to 2.6.6 with static exposition of files because the key changed. I fixed it by changing the properties key :
Looks like spring.resources.static-locations has been deprecated. It's indeed specified with this key in the document pruidong has linked : https://docs.spring.io/spring-boot/docs/2.6.5/reference/htmlsingle/#application-properties.web.spring.web.resources.static-locations
Best regards,
@hoowhoami @Toldwin Thank you for trying to help, but the use of @EnableWebMvc
means that none of Spring Boot's MVC auto-configuration properties will take effect.
It has been just over two weeks since the original request for feedback so I am going to close this now. @zzq1314zll if you have a chance to prepare and share the requested sample we can take another look.
Hello!, I upgraded the springboot version from 2.1.3.RELEASE to 2.6.5, and I found that my static resources could not be accessed.
Here are some of my configs
2.1.3.RELEASE
2.6.5
I don't know why, since the request doesn't go into springmvc I can't debug Thanks!