开发者社区> 问答> 正文

Spring配置文件中DOCTYPE与<beans xmlns>冲突问题

这是DOCTYPE

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd:/spring-beans.dtd">
这是beans里的配置
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

报错信息:]

Multiple annotations found at this line:
The content of element type "beans" must match "(description?,(import|alias| bean)*)".
Attribute "xsi:schemaLocation" must be declared for element type "beans".
Attribute "xmlns:xsi" must be declared for element type "beans".
Attribute "xmlns" must be declared for element type "beans".
Attribute "xmlns:tx" must be declared for element type "beans".
Attribute "xmlns:aop" must be declared for element type "beans".

求大神,

展开
收起
小旋风柴进 2016-03-04 16:19:43 6190 0
1 条回答
写回答
取消 提交回答
  • 你试试

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans  xmlns="http://www.springframework.org/schema/beans"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:aop="http://www.springframework.org/schema/aop"
            xmlns:tx="http://www.springframework.org/schema/tx"
            xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
                <!-- Spring AOP 日志管理 -->
    <!-- 将日志类注入到bean中 -->
    <bean id="advices" class="advice.Advices"></bean>
    
    <aop:config>
        <!-- 调用日志类 -->
        <aop:aspect id="advice" ref="advices">
            <aop:pointcut expression="execution(* action.*.*(..))" id="log"/>
            <aop:before method="before" pointcut-ref="log"/>
            <aop:after method="afterReturning" pointcut-ref="log"/>
            <aop:after-throwing method="afterThrowing" pointcut-ref="log"/>
        </aop:aspect>
    
    </aop:config>
    2019-07-17 18:52:28
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多