0
I’m doing a REST API in Spring Boot and I’m having a hard time bringing the results of a Repository query.
I have this MER, which is a small part of my bank:
I built these two entities in Java, which resulted in the following classes (omitted getters, setters and Imports from all following classes so the images don’t get too big):
As the same street (that is, an avenue, for example) can have several Zip Codes (see Avenida Sapopemba, Avenida Paulista etc), then the query should return me to the Street with a list of Street Codes (if the same Street has more than one zip code). I can search for any of the three parameters: either by nameLogradouro (Street class) or by numeroCepLogradouro and numeroCepComplementLogradouro (Street class).
My Repository is like this:
My kind of service is like this:
And my controller is like this:
But when I run the project, it makes the following mistake:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logradouroApiController': Unsatisfied dependency expressed through field 'logradouroService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logradouroService': Unsatisfied dependency expressed through field 'logradouroDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logradouroDao': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.projeto.referencia.dao.LogradouroDao.findLogradouroByParameters(java.lang.String,java.lang.Integer,java.lang.Integer)!
The project is configured 100% straight:
I think I’m doing some nonsense when returning the list of Logradourocep (who is the daughter of the object Logradouro) of the query. Could someone please help me?
Good Morning, your makers are public or private?
– Caio Augusto Papai
Hello! I suggest exchanging the images for text, because then people with a problem similar to yours will find the problem more easily. Use OS formatting tools for code.
– Dherik