配置spring多資料來源時候發生的問題及解決

2021-08-30 01:57:02 字數 303 閱讀 8905

最近因為專案中需要配置多資料來源,所以在網上找到這篇文章

驚喜發現原來spring2.0以後已經帶了這個功能,

所以,二話不說,按照文章就弄了個demo,結果,tomcat啟動就報

attribute "key-type" must be declared for element type "map".

百思不解,後問計於google。方得知

原來我用的spring的配置的dtd是比較老式的。

">

如果想用此功能的話,必須用新式的dtd

">

換上後一切ok!

spring多資料來源配置

前段時間由於公司專案需求,需要多資料來源的支援,苦b折騰了兩天程式猿,話不多說,直接擼碼。classpath jdbc.properties select 1 true select 1 true org.hibernate.dialect.mysqldialect false update tru...

spring 多資料來源配置

以下是我的xml配置,在配置的過程中涉及到不同的包分配不同的資料來源,在這裡用逗號分割就好 當然萬用字元能結局的那是最好了.xmlns xsi xmlns aop xmlns tx xmlns task xmlns context xmlns rabbit xsi schemalocation sp...

spring 多資料來源配置方式

核心配置檔案 com.util.dialectforinkfish true none com.common.model 1.基於註解的配置方式 可以在類或方法上註解 1 xml 2 class retention retentionpolicy.runtime target public inte...