Skip to content
Advertisement

JAVA: Error creating bean with name; Unsatisfied dependency expressed through field

I have the following code and structure. I am getting the following error, it is very long error message.

Error creating bean with name ‘departmentController’: Unsatisfied dependency expressed through field ‘departmentService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:

Entity Class

JavaScript

Repository Interface

JavaScript

Service Class

JavaScript

Controller Class

JavaScript

Main class

JavaScript

Project Structure

JavaScript

Full Error Stack Trace:

JavaScript

Advertisement

Answer

The actual error is:

JavaScript

Your repository method:

JavaScript

But you dont have id property in your Department entity. You have departmentId. So try renaming your method to something like:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement