Parameter 0 of constructor in ProductManager required a bean of type 'dataAccess.DataRepository' that could not be found

Viewed 19

Description:

Parameter 0 of constructor in kockadir.northwind.northProject.business.concretes.ProductManager required a bean of type 'kockadir.northwind.northProject.dataAccess.DataRepository' that could not be found.

Action:

Consider defining a bean of type 'kockadir.northwind.northProject.dataAccess.DataRepository' in your configuration.



    package kockadir.northwind.northProject.business.concretes;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import kockadir.northwind.northProject.business.abstracts.ProductService;
import kockadir.northwind.northProject.dataAccess.DataRepository;
import kockadir.northwind.northProject.entities.concretes.Product;



@Service
public class ProductManager implements ProductService{
    
    DataRepository dataRepo;
    
    public ProductManager() {
        
    }
    @Autowired
    public ProductManager(DataRepository dataRepo) {
        this.dataRepo = dataRepo;
    }


    @Override
    public List<Product> getAll() {
        return this.dataRepo.findAll();
    }


    @Override
    public Product getByProductName(String name) {
        return dataRepo.getByProductName(name);
    }

}
package kockadir.northwind.northProject.dataAccess;


import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Repository;

import kockadir.northwind.northProject.entities.concretes.Product;

@Repository
public interface DataRepository extends JpaRepositoryImplementation<Product, Integer> {
    
    Product getByProductName(String name);
    
    

}
0 Answers
Related