Fix RepositoryFunctionalTests
Due to the decoupling of `PagingAndSortingRepository` from `CrudRepository` in Spring Data 3 [1], this test has to be updated to use different repositories between the reader and the writer according to the expected types for the `repository` property. [1]: https://github.com/spring-projects/spring-data-commons/issues/2537
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.sample.data;
|
||||
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface CustomerCreditCrudRepository extends CrudRepository<CustomerCredit, Long> {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,6 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
|
||||
public interface CustomerCreditRepository extends PagingAndSortingRepository<CustomerCredit, Long>{
|
||||
public interface CustomerCreditPagingAndSortingRepository extends PagingAndSortingRepository<CustomerCredit, Long>{
|
||||
Page<CustomerCredit> findByCreditGreaterThan(BigDecimal credit, Pageable request);
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
class="org.springframework.batch.item.data.RepositoryItemReader" scope="step">
|
||||
<property name="pageSize" value="2"/>
|
||||
<property name="methodName" value="findByCreditGreaterThan"/>
|
||||
<property name="repository" ref="customerCreditRepository"/>
|
||||
<property name="repository" ref="customerCreditPagingAndSortingRepository"/>
|
||||
<property name="arguments">
|
||||
<list>
|
||||
<value>#{new java.math.BigDecimal(jobParameters[credit])}</value>
|
||||
@@ -27,7 +27,7 @@
|
||||
<bean id="itemWriter"
|
||||
class="org.springframework.batch.item.data.RepositoryItemWriter">
|
||||
<property name="methodName" value="save"/>
|
||||
<property name="repository" ref="customerCreditRepository"/>
|
||||
<property name="repository" ref="customerCreditCrudRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
|
||||
Reference in New Issue
Block a user