title: Error creating bean . Unsatisfied dependency expressed through constructor parameter 0;
body: <p>Now get this error:</p>
  
  <pre><code>Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2018-06-24 15:55:37.651 ERROR 6924 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deliveryController' defined in file [D:\Max\JavaWorks\Diplom\OnlineShop\target\classes\com\maximmalikov\onlineshop\rest\DeliveryController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deliveryService' defined in file [D:\Max\JavaWorks\Diplom\OnlineShop\target\classes\com\maximmalikov\onlineshop\service\DeliveryService.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordersRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.maximmalikov.onlineshop.domain.Orders com.maximmalikov.onlineshop.repository.OrdersRepository.getByUserId(com.maximmalikov.onlineshop.domain.Users)! No property userId found for type Orders! Did you mean 'users'?
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
      at...
  
  Process finished with exit code 0
  </code></pre>
  
  <p>My pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.maximmalikov&lt;/groupId&gt;
      &lt;artifactId&gt;onlineshop&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;onlineshop&lt;/name&gt;
      &lt;description&gt;Onlineshop project for Spring Boot&lt;/description&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.0.3.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>The main class, the class of service and the class of the controller with the repository:</p>
  
  <pre><code>@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, WebMvcAutoConfiguration.class})
  @SpringBootApplication
  public class OnlineshopApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(OnlineshopApplication.class, args);
      }
  
  }
  
  @Repository
  public interface OrdersRepository extends JpaRepository&lt;Orders,Long&gt; {
  
      Orders getByOrderNumber(long orderNumber);
  
      Orders getByOrderDate(Date orderDate);
  
      Orders getByGoodsProductId(Goods productId);
  
      Orders getByGoodsProductName(Goods productName);
  
  }
  
     @Service
  @RequiredArgsConstructor(onConstructor = @__(@Autowired))
  public class OrdersService {
  
      private final OrdersRepository ordersRepository;
  
      private final GoodsRepository goodsRepository;
  
      private final UsersRepository usersRepository;
  
      private final DeliveryRepository deliveryRepository;
  
      private OrdersDTO fromOrders(Orders order) {
          if (order != null) {
              return OrdersDTO.builder()
                      .orderNumber(order.getOrderNumber())
                      .orderDate(order.getOrderDate())
                      .orderTime(order.getOrderTime())
                      .orderStatus(order.getOrderStatus())
                      .paymentMethod(order.getPaymentMethod())
                      .goods(order.getGoods() != null
                              ? order.getGoods().stream()
                              .map(Goods::getProductId)
                              .collect(Collectors.toList())
                              : null)
                      .users(order.getUsers() != null
                              ? order.getUsers().stream()
                              .map(Users::getUserId)
                              .collect(Collectors.toList())
                              : null)
                      .delivery(order.getDelivery().getOrderNumber())
                      .build();
          }
          return null;
      }
  
      private Orders fromDTO(OrdersDTO ordersDTO) {
          if (ordersDTO != null) {
              return Orders.builder()
                      .orderNumber(ordersDTO.getOrderNumber())
                      .orderDate(ordersDTO.getOrderDate())
                      .orderTime(ordersDTO.getOrderTime())
                      .orderStatus(ordersDTO.getOrderStatus())
                      .paymentMethod(ordersDTO.getPaymentMethod())
                      .goods(ordersDTO.getGoods() != null
                              ? goodsRepository.findAllById(ordersDTO.getGoods())
                              : null)
                      .users(ordersDTO.getUsers() != null
                              ? usersRepository.findAllById(ordersDTO.getUsers())
                              : null)
                      .delivery(ordersDTO.getDelivery() &gt; 0L
                              ? deliveryRepository.getOne(ordersDTO.getDelivery())
                              : null)
                      .build();
          }
          return null;
      }
  
      public List&lt;OrdersDTO&gt; getAllOrders() {
          return ordersRepository.findAll().stream()
                  .map(this::fromOrders)
                  .collect(Collectors.toList());
      }
  
      @Transactional
      public OrdersDTO addOrder(OrdersDTO ordersDTO) {
          if (!ordersRepository.existsById(ordersDTO.getOrderNumber())) {
              return fromOrders(ordersRepository.saveAndFlush(fromDTO(ordersDTO)));
          }
          return null;
      }
  
      @Transactional
      public void deleteByOrderNumber(long orderNumber) {
          if (ordersRepository.existsById(orderNumber)) {
              ordersRepository.deleteById(orderNumber);
          }
      }
  
      @Transactional
      public OrdersDTO updateOrder(OrdersDTO ordersDTO) {
          if (ordersRepository.existsById(ordersDTO.getOrderNumber())) {
              Orders ordersTemp = ordersRepository.getOne(ordersDTO.getOrderNumber());
              ordersTemp.setOrderDate(ordersDTO.getOrderDate());
              ordersTemp.setOrderTime(ordersDTO.getOrderTime());
              ordersTemp.setOrderStatus(ordersDTO.getOrderStatus());
              ordersTemp.setPaymentMethod(ordersDTO.getPaymentMethod());
              return fromOrders(ordersRepository.saveAndFlush(ordersTemp));
          }
          return null;
      }
  
      public OrdersDTO getByOrderNumber(long orderNumber) {
          if (ordersRepository.existsById(orderNumber)) {
              return fromOrders(ordersRepository.getByOrderNumber(orderNumber));
          }
          return null;
      }
  
      public OrdersDTO getByOrderDate(Date orderDate) {
          return fromOrders(ordersRepository.getByOrderDate(orderDate));
      }
  
      public OrdersDTO getByProductId(Goods product) {
          return fromOrders(ordersRepository.getByGoodsProductId(goodsRepository.getByProductId(product.getProductId())));
      }
  
      public OrdersDTO getByProductName(Goods product) {
          return fromOrders(ordersRepository.getByGoodsProductName(goodsRepository.getByProductName(product.getProductName())));
      }
  
  }
  
     @RestController
  @RequestMapping("/orders")
  @RequiredArgsConstructor(onConstructor = @__(@Autowired))
  public class OrdersController {
  
      private final OrdersService ordersService;
      private final GoodsRepository goodsRepository;
  
  
      @GetMapping
      public List&lt;OrdersDTO&gt; getAll() {
          return ordersService.getAllOrders();
      }
  
      @PostMapping
      public ResponseEntity&lt;OrdersDTO&gt; addOrder(@RequestBody OrdersDTO ordersDTO) {
          OrdersDTO ordersDTO1 = ordersService.addOrder(ordersDTO);
          return ResponseEntity.ok(ordersDTO1);
      }
  
      @DeleteMapping("/{order_number}")
      public ResponseEntity&lt;Void&gt; deleteOrder(@PathVariable(value = "order_number") long orderNumber) {
          try {
              ordersService.deleteByOrderNumber(orderNumber);
              return ResponseEntity.ok().build();
          } catch (Exception e) {
              return ResponseEntity.badRequest().build();
          }
      }
  
      @PutMapping
      public ResponseEntity&lt;OrdersDTO&gt; updateOrder(@RequestBody OrdersDTO ordersDTO) {
          OrdersDTO ordersDTO1 = ordersService.updateOrder(ordersDTO);
          return ResponseEntity.ok(ordersDTO1);
      }
  
      @GetMapping("/{order_number}")
      public ResponseEntity&lt;OrdersDTO&gt; getOrderByNumber(@PathVariable(value = "order_number") long orderNumber) {
          return ResponseEntity.ok(ordersService.getByOrderNumber(orderNumber));
      }
  
      @GetMapping("/{order_date}")
      public ResponseEntity&lt;OrdersDTO&gt; getOrderByDate(@PathVariable(value = "order_date") Date orderDate) {
          return ResponseEntity.ok(ordersService.getByOrderDate(orderDate));
      }
  
      @GetMapping("/goods/{product_id}")
      public ResponseEntity&lt;OrdersDTO&gt; getOrderByProductId(@PathVariable(value = "product_id") long productId) {
          return ResponseEntity.ok(ordersService.getByProductId(goodsRepository.getByProductId(productId)));
      }
  
      @GetMapping("/goods/{product_name}")
      public ResponseEntity&lt;OrdersDTO&gt; getOrderByProductName(@PathVariable(value = "product_name") String productName) {
          return ResponseEntity.ok(ordersService.getByProductName(goodsRepository.getByProductName(productName)));
      }
  
  
  }
  </code></pre>
  
  <p>Configuring the Database Connection in application.properties:</p>
  
  <pre><code>spring.jpa.hibernate.ddl-auto=update
  spring.datasource.url=jdbc:mysql://localhost:3306/onlineshopbd?useSSL=false
  spring.datasource.username=root
  spring.datasource.password=malikovmaxim1997
  
  spring.jpa.show-sql=true
  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
  spring.jpa.open-in-view = true
  </code></pre>
  
  <p>The project was configured with Spring-Boot, and the configurations are all configured solely by means of annotations, that is, I've seen a lot of same problems on the Internet, but all the bin settings are configured in xml files.  This approach is not suitable for this project.  Help to understand this error, and how to adjust in that case bins, without using xml.</p>