'How to autowire a ResourceHandlerRegistry bean not found on application startup
We've recently updated an application with a configuration class that uses the ResourceHandlerRegistry class explained here
The application starts up fine in IntelliJ but when packaged into a JAR and run from the command line, startup fails because of this error:
Field registry in required a bean of type 'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry' in your configuration.
IntelliJ also highlights that it cannot find an autowire candidate for the bean. We are using Spring Boot v2.3.12.RELEASE and Spring v5.2.15.RELEASE.
Any help is welcome.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
