When using STS or eclipse to develop SpringMVC applications, I rely on it. . There is a little thing that I didn’t pay attention to for a long time
When STS created the SpringMVC project, it automatically generated the Dispatcher configuration file, and then when watching the tutorial, it used the <mvc:annotation-driven> annotation configuration
But there is an <annotation-driven> in the automatically generated xml, which is quite confusing, thinking that the version of the mvc constraint file is wrong, so the local constraints that have been configured for a long time are still useless.
Later, I decided to take a closer look at the problem and found it through code layout and alignment. . . . . Damn, the prefix also needs to be configured! ! Change to the code shown below. Ok
Note that the blue one is the previous one, change it to red, there will be one more: mvc
The prefix “mvc” for element “ mvc: annotation-driven” is not bound abnormal
<?xml version= “1.0” encoding= “UTF-8” ?>
<beans:beans
xmlns= ” http://www.springframework.org/schema/mvc”
xmlns:mvc= “http://www.springframework.org/schema/mvc”
xmlns:xsi= “http://www.w3.org/2001/XMLSchema-instance”
xmlns:beans= “http://www.springframework.org/schema/beans”
xmlns:context= “http://www.springframework.org/schema/context”
xsi:schemaLocation= “
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd” >
<mvc:annotation-driven />
<mvc:resources location= “/resources/” mapping= “/resources/**” />
</beans:beans>
Similar Posts:
- [Solved] JAVA Error: org.springframework.beans.factory.BeanCreationException
- Spring Custome schema Loading Error: White spaces are required between publicId and systemId.
- Cannot find the declaration of element ‘beans’
- Springboot Failed to parse configuration class [x]
- The requested resource [/servlet] in JavaWeb is not available [How to Solve]
- [Solved] Swagger Error: Failed to start bean ‘documentationPluginsBootstrapper’
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field
- [Solved] No qualifying bean of type ‘org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder’ available:
- [Solved] Spring Error: Artifact spring:war exploded: Error during artifact deployment. See server log for details
- [Solved] Dependency injection exception: org.springframework.beans.factory.UnsatisfiedDependencyException