程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> spring-Spring配置文件中DOCTYPE與<beans xmlns>沖突問題

spring-Spring配置文件中DOCTYPE與<beans xmlns>沖突問題

編輯:編程綜合問答
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".

求大神,

最佳回答:


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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved