配置文件代码如下:
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd>
http://www.springframework.org/schema/aop>
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="userService" class="demo.service.UserServiceImpl"></bean>
<bean id="optlogger" class="demo.aop.OptLogger"></bean>
<aop:config>
<aop:pointcut id="servicepointcut"
expression="execution(* demo.service.*.*(..))" />
<aop:aspect id="loggeraspect" ref="optlogger">
<aop:before method="logger" pointcut-ref="servicepointcut"/>
</aop:aspect>
</aop:config>
</beans>测试类代码如下:
package demo.service;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Test {
private static final String CONFIGS = "aop.xml";
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext(CONFIGS);
UserService userService = (UserService)ac.getBean("userService");
userService.update();
userService.save();
userService.delete();
}
}运行之后报这样的异常:Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [aop.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
请问到底是哪里的问题?
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd>
http://www.springframework.org/schema/aop>
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="userService" class="demo.service.UserServiceImpl"></bean>
<bean id="optlogger" class="demo.aop.OptLogger"></bean>
<aop:config>
<aop:pointcut id="servicepointcut"
expression="execution(* demo.service.*.*(..))" />
<aop:aspect id="loggeraspect" ref="optlogger">
<aop:before method="logger" pointcut-ref="servicepointcut"/>
</aop:aspect>
</aop:config>
</beans>测试类代码如下:
package demo.service;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Test {
private static final String CONFIGS = "aop.xml";
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext(CONFIGS);
UserService userService = (UserService)ac.getBean("userService");
userService.update();
userService.save();
userService.delete();
}
}运行之后报这样的异常:Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [aop.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
请问到底是哪里的问题?
解决方案 »
- tomcat自带连接池问题
- 求解●●●关于TOMCAT SSL单双向认证分模块配置●●●
- smartupload如何上传test文件夹下的所有文件
- 自动处理表格、纠正非法输入的问题
- 不知道为什么多了450分啊!刚好用来问问题啊!!最近在学习xml啊!过程中有许多不明白的问题啊!还有一篇好文章介绍给大家啊
- eclipse 发布项目时找不到 要发布的项目, 项目已经被导入eclipse ,求救
- 抓取网页数据
- 请教怎样用JSP开发项目
- 学习(android)java网络聊天编程时遇到的问题
- js在别的页面都没问题,在某个页面就出现一些错误,帮我找找哪里错了
- jquery在eclipse中怎么使用
- 请问为什么我的while(rs.next())只显示最后一条记录?
刚开始知道肯定是配置文件解析的问题,后来没办法一行一行的看,果真多了两个">"。删除后问题就解决了
自己给自己做个反面教材吧