markbug 2015-12-12 04:48 采纳率: 77.8%
浏览 10572
已采纳

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".

求大神,

  • 写回答

5条回答

  • markbug 2015-12-12 06:05
    关注

    <?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>
    

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能