1. 程式人生 > >spring配置出現字首 "tx" 未繫結、字首 "mvc" 未繫結等情況

spring配置出現字首 "tx" 未繫結、字首 "mvc" 未繫結等情況

在進行spring整合配置時,啟動專案日誌提示“元素 “tx:annotation-driven” 的字首 “tx” 未繫結等情況.
是因為沒有在配置檔案中定義tx開頭的名稱空間。
以tx為例,可在spring的配置檔案中,新增以下配置(紅色箭頭部分)
這裡寫圖片描述:

<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:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

同理,如果報出 “元素 ‘aop’ 未繫結,字首 ‘mvc’ 未繫結”,字首 “context” 等,也可用以上方法解決。