Ошибка bean при запуске SpringJAVA

Программисты JAVA общаются здесь
Ответить
Гость
 Ошибка bean при запуске Spring

Сообщение Гость »

Я получаю эту ошибку при попытке запустить проект

ПРИЛОЖЕНИЕ НЕ ЗАПУСКАЕТСЯ

Описание:
Полю proxy в com.example.Javer.controllers.JaverController требовался bean-компонент типа com.example.Javer.proxy.TransactionServiceProxy, который мог не быть найдено.
Точка внедрения имеет следующие аннотации:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Действие:
Рассмотрите возможность определения bean-компонента типа com.example.Javer.proxy.TransactionServiceProxy в вашей конфигурации.

Код: Выделить всё

controller

Код: Выделить всё

package com.example.Javer.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.Javer.dto.ClientCreateDto;
import com.example.Javer.dto.ClientResponseDto;
import com.example.Javer.proxy.TransactionServiceProxy;

@RestController
@RequestMapping("/servico/clientes")
public class JaverController {

@Autowired
private TransactionServiceProxy proxy;

@GetMapping
public ResponseEntity getAll() {
return proxy.getAllClients();
}

@PostMapping
public ResponseEntity create(@RequestBody ClientCreateDto dto) {
return proxy.createClient(dto);
}

@PutMapping("/{id}")
public ResponseEntity update(@PathVariable Long id, @RequestParam Float newBalance) {
return proxy.updateBalance(id, newBalance);
}

@DeleteMapping("/{id}")
public ResponseEntity delete(@PathVariable Long id) {
return proxy.deleteClient(id);
}

}

Код: Выделить всё

package com.example.Javer.proxy;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.example.Javer.dto.ClientCreateDto;
import com.example.Javer.dto.ClientResponseDto;

@FeignClient(name = "service", url = "http://localhost:8080")
public interface TransactionServiceProxy {

@GetMapping
public ResponseEntity getAllClients();

@PostMapping
public ResponseEntity createClient(@RequestBody ClientCreateDto dto);

@PutMapping("/{id}")
public ResponseEntity updateBalance(@PathVariable Long id, @RequestParam Float newBalance);

@DeleteMapping("/{id}")
public ResponseEntity deleteClient(@PathVariable Long id);

}

Код: Выделить всё

application

Код: Выделить всё

package com.example.Javer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class JaverApplication {

public static void main(String[] args) {
SpringApplication.run(JaverApplication.class, args);
}

}

Код: Выделить всё

application.properties

Код: Выделить всё

spring.application.name=Javer

server.port=8081

spring.datasource.url=jdbc:h2:mem:javer
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=nss
spring.datasource.password=
spring.h2.console.enabled=true
Я пытаюсь запустить его, но он выдает эту ошибку

Подробнее здесь: https://stackoverflow.com/questions/793 ... dar-spring
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»