PropertyReferenceException: No property saveAll found for type Dummy!

I recently started using ReactiveCouchbaseRepository (spring-data-couchbase - 3.0.0.M2, spring-boot-starter-parent - 2.0.0.M2) in one of our projects.

I referred to https://github.com/spring-projects/spring-data-couchbase/blob/master/src/main/asciidoc/reactiverepository.adoc and setup the project but I am getting the following error.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dummyRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property saveAll found for type Dummy!
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1717) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:305) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:233) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:303) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:250) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]

Here is the relevant information about setting up my project.

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.M2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    ...
    
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-couchbase</artifactId>
            <version>3.0.0.M2</version>
        </dependency>
public interface DummyRepository extends ReactiveCouchbaseSortingRepository<Dummy, String> {

}
public class Dummy {

    @Id
    private final String id;

    @Field
    private final String name;

    @Field
    private final String address;
  
    ...
@Configuration
@EnableReactiveCouchbaseRepositories
public class CouchbaseDatabaseConfig extends AbstractReactiveCouchbaseConfiguration {

  ...
}

Now saveAll is a repository method name and obviously that property name won’t exist in the model Dummy. Can anyone throw any light on this?

Note that when I change from ReactiveCouchbaseSortingRepository to CouchbaseRepository, the things work fine. (Of course, I also have to change reactive-ness of the code to non-reactive. But at least I am successfully able to retrieve the document from db.)

Thanks in advance, for any help. :slight_smile:

Hi @nilesh_ca,

If using spring-data-couchbase with spring-boot, the best way to add SDC dependency is by adding the starter
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-couchbase</artifactId> </dependency>
We have saveAll implementation for reactive repository.

Thank you @subhashni. That indeed solved the problem that I originally asked for. :slight_smile:

However, I am not sure why I get the following error.

For RxJava 1.x adapter support please add "io.reactivex:rxjava-reactive-streams": rx.Observable <~ For Flux operations
For RxJava 1.x adapter support please add "io.reactivex:rxjava-reactive-streams": rx.Single <~ For Mono operations

There is a long stacktrace which I am not putting here. But it boils down to following lines…

java.lang.IllegalArgumentException: For RxJava 1.x adapter support please add "io.reactivex:rxjava-reactive-streams": rx.Observable
at org.springframework.util.Assert.isTrue(Assert.java:116) ~[spring-core-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.core.ReactiveAdapterRegistry.getAdapter(ReactiveAdapterRegistry.java:133) ~[spring-core-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.core.ReactiveAdapterRegistry.getAdapter(ReactiveAdapterRegistry.java:114) ~[spring-core-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.data.repository.util.ReactiveWrapperConverters$RxJava1ObservableToFluxConverter.lambda$convert$0(ReactiveWrapperConverters.java:639) ~[spring-data-commons-2.0.0.M4.jar:na]
at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:46) ~[reactor-core-3.1.0.M2.jar:3.1.0.M2]
...
Assembly trace from producer [reactor.core.publisher.FluxDefer] :
reactor.core.publisher.Flux.defer(Flux.java:695)
org.springframework.data.repository.util.ReactiveWrapperConverters$RxJava1ObservableToFluxConverter.convert(ReactiveWrapperConverters.java:639)
org.springframework.data.repository.util.ReactiveWrapperConverters$RxJava1ObservableToFluxConverter.convert(ReactiveWrapperConverters.java:633)
....
com.cureambit.xp.workshop.DummyController.users(DummyController.java:22)
org.springframework.web.reactive.result.method.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:213)
org.springframework.web.reactive.result.method.InvocableHandlerMethod.lambda$invoke$0(InvocableHandlerMethod.java:119)
reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:140)

All I am doing at the concerned line (in DummyController) is repository.findAll().

I have added support for io.reactivex:rxjava-reactive-streams in its latest version - 1.2.1, but still of no use.

Do you reckon, I need to add support for something special other than these?

Thanks again in advance for your help.

Oh please ignore the next question. It seems the project did not refresh itself after i added the io.reactivex:rxjava-reactive-streams dependency.

The things are working fine. Thanks again @subhashni for your earlier help. :slight_smile:

1 Like

Hi @subhashni I encounter very similar problem so I think it’s better to ask in same thread started by nilesh_ca

I tried reactive couchbase by starting with your project https://github.com/subalakr/springdatareactive

It works as expected if Repository is embedded inside main class. But when I take the Repository class out, I receive same “No property saveAll …” error

I turned off considerNestedRepositories=false and also set basePackages for EnableReactiveCouchbaseRepositories but it doesn’t help.

For normal Repository, it works just fine. Hopefully you could give some insight?

@nilesh_ca It seems that you have Repository class at top level (or at least not embedded). Do you encounter same issue as I described above?

Thanks,

Hi @hoahohart,

The dummy project that I used earlier, indeed has the Repository in a different package. All extra I did was to add the location of it in EnableReactiveCouchbaseRepositories. That project is (still) working fine.

However, every new project that I try to create (including the github project you have tried), with the exact similar settings to that of the dummy project (be it using, maven or gradle) indeed gives the same old problem again. And I have absolutely no clue why!

I have double checked the dependencies/settings/etc. with the working-dummy-project but could not spot any difference (apart from spring.data.couchbase version been bumped from M2 to M4. Don’t know if that’s relevant though.)

@subhashni can perhaps lead us to the right cause! Till then I will use the Repository as the inner class to the Application class (thanks @hoahohart for bringing that out in light!)

Thanks for confirming the issue @nilesh_ca Yeah, for experimental purpose, inner class is fine - but it’s not flexible for real projects.

Hopefully subhashni could help us figuring out why. In the mean time, I’ll tick to the non-reactive way of accessing Couchbase

Hi @hoahohart,

Sorry about the late reply. SDC reactive kay is not fully integrated with spring-boot, the creation of beans and autowiring of the reactive repository works best on embedded now, the support for auto reactive configuration is tracked here.

Thanks for the info and the issue tracking link @subhashni