作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个 spring 命令行应用程序并且在 Eclipse 中运行良好。但是在命令行中我收到以下错误;
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStore
Exception: Unrecognized xbean namespace mapping: http://www.springframework.org/
schema/aop
at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:284)
at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:156)
at org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
at org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:84)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.stereotype.Component;
@Component
public class SpringCommandLine {
private static final String APP_CONTEXT_PATH = "classpath:/BatchClientBeans.xml";
public static void main(String[] args) {
AbstractApplicationContext context = new ClassPathXmlApplicationContext(APP_CONTEXT_PATH);
context.registerShutdownHook();
BatchClientDAO batchClientDAOBean = (BatchClientDAO) context.getBean("batchClientDAOBean");
System.out.println("Next batch ID: " + batchClientDAOBean.getNextBatchId());
System.out.println("Exiting...");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
">
<bean id="batchClientDAOBean" class="com.test.data_analysis.client.BatchClientDAOImpl">
<property name="sqlMapClientTemplate" ref="sqlMapClientTemplateLocal" />
</bean>
</beans>
最佳答案
看起来你有错误的导入:
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
关于spring - 在命令行中运行 spring 应用程序时无法识别的 xbean 命名空间映射异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22532464/
我是一名优秀的程序员,十分优秀!