第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法使用 Spring Batch 框架連接到 Oracle 數(shù)據(jù)源

無法使用 Spring Batch 框架連接到 Oracle 數(shù)據(jù)源

溫溫醬 2021-07-07 09:04:44
我有一個小項目,用于學(xué)習(xí) Spring Batch。我想從 Oracle 數(shù)據(jù)庫讀取數(shù)據(jù)并寫入 XML 文件,但出現(xiàn)錯誤:創(chuàng)建名為“step1”的 bean 時出錯:設(shè)置 bean 屬性“jobRepository”時無法解析對 bean“jobRepository”的引用;嵌套異常是 org.springframework.beans.factory.BeanCreationException:在類路徑資源 [Spring/batch/config/spring-batch-contextOriginal.xml] 中定義名稱為“jobRepository”的 bean 創(chuàng)建時出錯:設(shè)置屬性值時出錯;嵌套異常是 org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSource' of bean class [org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean]: Bean 屬性 'dataSource' 不可寫或具有無效的 setter 方法。setter 的參數(shù)類型是否與 getter 的返回類型匹配?我想我把所有東西都放進(jìn)去了,但我認(rèn)為這個錯誤最重要的東西是:spring-batch-context.xml和spring-datasource.xml。我錯過了什么還是有什么問題?如果您需要更多詳細(xì)信息,請告訴我。謝謝你。(我在不使用數(shù)據(jù)庫的情況下嘗試了該示例,并且效果很好。)spring-batch-context.xml:    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://www.springframework.org/schema/beans                              http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> <import resource="../jobs/jobPerson.xml"/>  <import resource="../config/spring-datasource.xml" />    <!--  <context:annotation-config />    <tx:annotation-driven transaction-manager="transactionManager"/>a PlatformTransactionManager is still required     -->    <!-- JobRepository and JobLauncher are configuration/setup classes -->    <bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" >       <property name="dataSource" ref="dataSource" />        <property name="transactionManager" ref="transactionManager" />       <property name="databaseType" value="oracle" />     </bean>
查看完整描述

1 回答

?
寶慕林4294392

TA貢獻(xiàn)2021條經(jīng)驗 獲得超8個贊

在MapJobRepositoryFactoryBean不具備的屬性dataSource,transactionManager和databaseType。您應(yīng)該使用JobRepositoryFactoryBean代替MapJobRepositoryFactoryBean:


所以替換這個:


<!-- JobRepository and JobLauncher are configuration/setup classes -->

<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" >

   <property name="dataSource" ref="dataSource" /> 

   <property name="transactionManager" ref="transactionManager" />

   <property name="databaseType" value="oracle" /> 

</bean>

有了這個:


<!-- JobRepository and JobLauncher are configuration/setup classes -->

<bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" >

   <property name="dataSource" ref="dataSource" /> 

   <property name="transactionManager" ref="transactionManager" />

   <property name="databaseType" value="oracle" /> 

</bean>

它應(yīng)該工作。


查看完整回答
反對 回復(fù) 2021-07-14
  • 1 回答
  • 0 關(guān)注
  • 248 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號