Open manaymen opened 3 years ago
Looks like a dependency issue. Can you double check your service in injected and your packages are being scanned?
Get Outlook for iOShttps://aka.ms/o0ukef
From: manaymen @.> Sent: Sunday, May 9, 2021 6:23:27 AM To: getarrays/employeemanager @.> Cc: Subscribed @.***> Subject: [getarrays/employeemanager] APPLICATION FAILED TO START (#1)
Hello,
When i try to run the main class, i got this error: Parameter 0 of constructor in com..service.Service required a bean of type 'com..repo.Repo' that could not be found. [issue]https://user-images.githubusercontent.com/39166040/117568561-df320380-b0b8-11eb-9fc8-73ff92f15cf1.PNG
Thanks, Aymen
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/getarrays/employeemanager/issues/1, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALZWFJUAML6MPPUOMEITLYTTMZPB7ANCNFSM44O3Q5IQ.
Hi Aymen,
I need a bit more information to provide support. Can you please tell us how your classes look like. I will give some examples, to understand why I ask for them.
public interface EmployeeRepo extends JpaRepository<Employee, Long> { }
Did you extends from JpaRepository? If not it is possible, that you have an interface, which did not have a corresponding implementation class. So please check if you extends from the right interface.
@Service
@Transactional
public class EmployeeService {
private final EmployeeRepo employeeRepo;
@Autowired
public EmployeeService(EmployeeRepo employeeRepo) {
this.employeeRepo = employeeRepo;
}
The @Autowired
tells Spring to automaticly search for an implementation for the given dependency. In your case, the resolving fails, so that Spring is not able to find the right bean. This could be also a dependency problem, in fact that the implementation is generated by the Spring Boot Starter JPA, so please also check if you have the following dependency in your pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Please check if the provided information is enough to get you project running. Otherwise I can take a closer look, if you provide a link to your sources.
Best regards,
Thomas
Hey Even I am getting the same error..!
Hello,
When i try to run the main class, i got this error: Parameter 0 of constructor in com.*.service.*Service required a bean of type 'com..repo.Repo' that could not be found. Any ideas ?
Thanks, Aymen