Search code examples
spring-data-jpaspring-data-couchbase

Consider defining a bean named 'couchbaseRepositoryOperationsMapping' in your configuration. Spring Boot


Any help appreciated !

I have a spring boot application to be connected to couchbase with following details

  1. Repository interface

    
     @Repository 
     public interface UserRepository extends CrudRepository [Users,Strings] {
    
         List findByFullName(String fullName); 
     }
    
     
  2. Controller class

    
     @RestController
     @Component
     public class MyController {
    
     @Autowired
     UserRepository userRepository;
    
     @PostMapping("/addUser")
     public ResponseEntity addNewUser(@RequestBody Users user)
     {
     userRepository.save(user);
     }
     
  3. Couchbase configs

    
    @Configuration
    public class CouchbaseConfigurations extends AbstractCouchbaseConfiguration {
    
        @Override
        public String getConnectionString() {
            // TODO Auto-generated method stub
            return "couchbase://127.0.0.1";
        }
    
        @Override
        public String getUserName() {
            // TODO Auto-generated method stub
            return "Administrator";
        }
    
        @Override
        public String getPassword() {
            // TODO Auto-generated method stub
            return "Administrator";
        }
    
        @Override
        public String getBucketName() {
            // TODO Auto-generated method stub
            return "Users";
        }
    
    
    
    
    }

    When I try to start the application it throws following error, I tried to search many articles here and outside but they did not help

    Description:
    
    Field userRepository in com.mystery.controllers.MyController required a bean named 'couchbaseRepositoryOperationsMapping' that could not be found.
    [![enter image description here][1]][1]
    The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=true)
    
    
    Action:
    
    Consider defining a bean named 'couchbaseRepositoryOperationsMapping' in your configuration. 

    Any help would be appreciated, otherwise things seems good.


Solution

  • I raised the issue with spring community and upgrading to a higher spring version resolved the issue https://github.com/spring-projects/spring-data-couchbase/issues/1435