Мой класс ресурсов не находит служебный компонент, определенный в приложении Spring Boot.JAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Мой класс ресурсов не находит служебный компонент, определенный в приложении Spring Boot.

Сообщение Anonymous »

Я определил компонент обслуживания студентов:

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

@Component
public class StudentService {

private final StudentDao studentDao;

@Autowired
public StudentService(@Qualifier("fakeDao") StudentDao studentDao) {
this.studentDao = studentDao;
}

//for the sake of relevance not putting other methods here, but I have all CRUD methods defined here
//in the class.
}
Мой класс StudentResource выглядит следующим образом:

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

@RestController
@RequestMapping("api/v1/students")
public class StudentResource {

@Autowired
private final StudentService studentService;

public StudentResource(StudentService studentService) {
this.studentService = studentService;
}
}
Когда я запускаю приложение, я получаю следующую ошибку:

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

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2m2020-10-05 22:06:19.236[0;39m [31mERROR[0;39m [35m7228[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter  [0;39m [2m:[0;39m

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.centene.demo.resource.StudentResource required a bean of type 'org.centene.demo.service.StudentService' that could not be found.

Action:
Consider defining a bean of type 'org.centene.demo.service.StudentService' in your configuration.
только некоторая информация об используемых версиях:
JAva 1.8
Spring boot 2.3.4


Подробнее здесь: https://stackoverflow.com/questions/642 ... ot-applica
Реклама
Ответить Пред. темаСлед. тема

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

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

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

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

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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