This is WebConfig code I am working on:
package hello.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.se
The problem is that WebConfig
is in the config
package and Application
is in the hello
package. @SpringBootApplication
on Application
enables component scanning for the package in which it's declared and that package's sub-packages. In this case that means that hello
is the base package for component scanning and, therefore, WebConfig
in the config
package is never found.
To solve the problem I'd move WebConfig
into the hello
package or a sub-package, for example hello.config
.
Your latest update on GitHub changed WebConfig
from extending WebMvcConfigurerAdapter
to extending WebMvcConfigurationSupport
. WebMvcConfigurationSupport
is the class that is imported by @EnableWebMvc
so annotating your class with @EnableWebMvc
and extending WebMvcConfigurationSupport
will be configuring things twice. You should go back to extending WebMvcConfigurerAdapter
as you were before.