Felix
Felix

Reputation: 83

Consider defining a bean of type '...' in your configuration

I am trying to run this application but I get the following error:

Description: Parameter 0 of method setPersonService in com.x.y.controller.AuthenticationController required a bean of type 'com.x.y.service.PersonService' that could not be found.

Action: Consider defining a bean of type 'com.x.y.service.PersonService' in your configuration.

My PersonService.java class:

package com.x.y.service;

import com.x.y.dao.Person;
import com.x.y.domain.PersonList;
import com.x.y.feedback.ImportFeedback;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.util.List;
import java.util.Optional;

@Service
public interface PersonService {

    PersonList getAllPeople(Pageable pageable);

    List<Person> getPeople(Pageable pageable);
    long getTotalCount();

    PersonList getAllPeople(Pageable pageable, String searchString);

    Optional<Person> findPersonById(Long id);

    Person findByXEmployeeId(String XEmployeeId);

    Person savePerson(Person person);

//    void updatePerson(Person person);

    ImportFeedback importPeopleFromExcelFile(InputStream inputStream);

}

What should I do to resolve this issue so I can run my application?

Upvotes: 0

Views: 5170

Answers (1)

aarush gandhi73
aarush gandhi73

Reputation: 95

What i am guessing by your code is that you must be having a PersonServiceImpl class in your project that must be implementing your PersonService class

So, Add @Service to PersonServiceImpl class,

remove @Service from PersonService class

Upvotes: 1

Related Questions