DynamoDB-找不到存储库bean

时间:2018-07-24 17:57:43

标签: spring-boot amazon-dynamodb

我正在尝试将Spring Boot与DynamoDB一起使用。这是项目的层次结构:

enter image description here

我遇到以下错误

WARN 79115 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webController': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'klit.demo.repo.CustomerRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

那是我的课程

@EnableScan
public interface CustomerRepository extends CrudRepository<Customer, String>{
}

@RestController
public class WebController {
    @Autowired
    CustomerRepository repository;

    @RequestMapping("/save")
    public String save() {
        repository.save(new Customer("JSA-1", "Jack", "Smith"));
        return "Done";
    }

    @RequestMapping("/findall")
    public String findAll() {
        String result = "";
        Iterable<Customer> customers = repository.findAll();

        for (Customer cust : customers) {
            result += cust.toString() + "<br>";
        }

        return result;
    }

}

它不能将存储库识别为bean ...

0 个答案:

没有答案