Question: * * * * * * * * * * * * * * * * * * * * * * * * *

***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.example.JobApplication.demo.service.JobServiceImpl required a bean of type 'com.example.JobApplication.demo.repository.JobRepository' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.JobApplication.demo.repository.JobRepository' in your configuration.
reason for error and solution
Service class
package com.example.JobApplication.demo.service;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.example.JobApplication.demo.Job.Job;
import com.example.JobApplication.demo.repository.JobRepository;
@Service
@Transactional
public class JobServiceImpl implements JobService {
private final JobRepository jobRepository;
@Autowired
public JobServiceImpl(JobRepository jobRepository){
this.jobRepository = jobRepository;
}
Repository
package com.example.JobApplication.demo.repository;
import java.util.Optional;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import com.example.JobApplication.demo.Job.Job;
@Repository
public interface JobRepository extends JpaRepository {
Optional findById(Long id);
}
Springboot class
package com.example.JobApplication.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableAutoConfiguration
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args){
SpringApplication.run(DemoApplication.class, args);
}
}
I have sent the classes as well as the path of pakcage please check

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!