java - Spring, component-scan causes FatalBeanException around NamespaceHandler -
I get an exception exception when I use component-scan:
Reason: Organization .springframework.beans.FatalBeanException: [org.springframework.context.config.ContextNamespaceHandler] for namespace [http://www.springframework.org/schema/context] [org.springframework.beans.factory]. Xml does not apply org.springframework.beans.factory.xml.difaultNamespaceHandlerResolver.resolve (org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement) on Org.springframework on org.springframework on org.springframeswork.beans.factory .xml.BeanDefinitionParserDelegate.parseCustomElement org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions (DefaultBeanDefinitionDocumentReader.java:195) at (BeanDefinitionParserDelegate.java:1428) org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader .deRegisterBeanDefinitions (DefaultBeanDefinitionDocumentReader.java:139) Here the XML configuration is.
& lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; Beans xmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: reference = "http: // www. Springframework.org/schema/context "xsi: schema location =" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http: //www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> & Lt; Bean id = "version" class = "java.lang.String" & gt; & Lt; Constructor-arg value = "$ {project.version}" /> & Lt; / Bean & gt; & Lt; Reference: component-scan base-package = "base" />
When I remove component-scan , it is properly parsed, but obviously this is not a solution. How is it I've read a lot about the old version of the spring classpath, but I can verify that this is not the case.
My dependence here is $ {spring.version} I 3.2.5-release
& lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring-beans & lt; / ArtifactId> & Lt; Version & gt; $ {Spring.version} & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring expression & lt; / ArtifactId> & Lt; Version & gt; $ {Spring.version} & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring core & lt; / ArtifactId> & Lt; Version & gt; $ {Spring.version} & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring Reference & lt; / ArtifactId> & Lt; Version & gt; $ {Spring.version} & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring test & lt; / ArtifactId> & Lt; Version & gt; $ {Spring.version} & lt; / Edition & gt; & Lt; Scope & gt; Trial & lt; / Scope & gt; & Lt; / Dependencies & gt;
I had a similar error, but the XML reference file was loaded, Namespace was Spring-WebMVC Reference I forgot to add MVC dependence to my pom file.
Comments
Post a Comment