Spring R2dbcRepository BeanCreationException未找到类型的属性findAll
我尝试更新整个应用程序,并使用PostgreSQL的反应式编程方法,因此我正在更新存储库,并使其从R2dbcRepository扩展,更新了相关服务以处理Mono和Flux。 当我尝试运行应用程序时,出现了一个异常Spring R2dbcRepository BeanCreationException未找到类型的属性findAll,spring,reactive-programming,spring-data-r2dbc,r2dbc,Spring,Reactive Programming,Spring Data R2dbc,R2dbc,我尝试更新整个应用程序,并使用PostgreSQL的反应式编程方法,因此我正在更新存储库,并使其从R2dbcRepository扩展,更新了相关服务以处理Mono和Flux。 当我尝试运行应用程序时,出现了一个异常 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'temperatureLibraryReactiveRepository' defined in com.P
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'temperatureLibraryReactiveRepository'
defined in com.PlayGroundAdv.Solar.repositories.reactive.TemperatureLibraryReactiveRepository defined
in @EnableR2dbcRepositories declared on SolarApplication: Invocation of init method failed
nested exception is java.lang.IllegalArgumentException: Failed to create query for method
public abstract reactor.core.publisher.Flux
com.PlayGroundAdv.Solar.repositories.reactive.TemperatureLibraryReactiveRepository.findAll(org.springframework.data.domain.Pageable)!
No property findAll found for type TemperatureLibraryEntity!
我不确定这是否是由于使用了Pageable
,如果是这种情况,我没有找到任何替代方法来使用R2DBC方法
使用JPA方法时,一切都很好
这是我的存储库
import com.PlayGroundAdv.Solar.entity.TemperatureLibraryEntity;
import com.PlayGroundAdv.Solar.model.AllPostalCodeModel;
import org.springframework.data.domain.Pageable;
import org.springframework.data.r2dbc.repository.Modifying;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import javax.transaction.Transactional;
@Repository
public interface TemperatureLibraryReactiveRepository extends R2dbcRepository<TemperatureLibraryEntity, Long> {
// A.B 11-18 Get All Temp By postal Code
Flux<TemperatureLibraryEntity> findByPostalCode(String postalCode, Pageable pageable);
String FIND_POSTAL_CODE = "SELECT new com.PlayGroundAdv.Solar.model.AllPostalCodeModel ( u.id, u.postalCode) FROM TemperatureLibraryEntity u order by u.postalCode";
@Transactional
@Modifying
@Query(value = FIND_POSTAL_CODE)
Flux<AllPostalCodeModel> findAllPostalCode();
Flux<TemperatureLibraryEntity> findAll(Pageable pageable);
}
导入com.PlayGroundAdv.Solar.entity.TemperatureLibraryEntity;
导入com.PlayGroundAdv.Solar.model.allPostalCodel;
导入org.springframework.data.domain.Pageable;
导入org.springframework.data.r2dbc.repository.Modifying;
导入org.springframework.data.r2dbc.repository.Query;
导入org.springframework.data.r2dbc.repository.r2dbcrespository;
导入org.springframework.stereotype.Repository;
导入reactor.core.publisher.Flux;
导入javax.transaction.Transactional;
@存储库
公共接口TemperatureLibraryReactiveRepository扩展了R2dbcRepository{
//A.B 11-18通过邮政编码获取所有临时工
Flux findByPostalCode(字符串postalCode,可分页);
字符串FIND_postalCode=“从TemperatureLibrary实体u order by u.postalCode中选择new com.PlayGroundAdv.Solar.model.allPostalCode(u.id,u.postalCode)”;
@交易的
@修改
@查询(值=查找邮政编码)
通量findAllPostalCode();
流量findAll(可分页);
}
@repository
注释,将basePackages
设置为包含enabler2dbcrespositories
中存储库的包
分页和存储