【Spring】批量配置文件报错
一、问题
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the
console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2
internal initialization logging.
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
problem: Failed to import bean definitions from relative location [application-common-persistence.xml]
Offending resource: class path resource [commonConfig.xml]; nested exception is
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from class path
resource [application-common-persistence.xml] is invalid; nested exception is org.xml.sax.SAXParseException;
lineNumber: 11; columnNumber: 65; cvc-elt.1: 找不到元素 'beans' 的声明。
二、解决
原因是spring-beans配置那里出了问题,之前配置了spring-beans的版本后,后来删了版本号之后,前面有个“-”没有删除,粗心了;以后类似的情况,检查下spring-beans配置的版本,或者有无单词打错了;(是beans不是bean);而且,很诡异的是,这里即使打错了,在IntelliJ Idea中任然可以暗转ctrl+鼠标左键,跳转到spring-beans文件里去,所以不要太相信,【能点进去就没错】;