0

I have the same problem as here, with the difference that my import is correct and it's still not working. I have this class:

@Service
public class UserServiceDB {

    @Autowired
    private ApplicationUserRepository userRepository;

    // ....
}

And the ApplicationUserRepository interface:

@Repository
public interface ApplicationUserRepository extends JpaRepository<ApplicationUser, Long> {
    ApplicationUser findByUsername(String username);
}

When I run my app, it gives me the following error:

Description:
Field userRepository in auth.user.UserServiceDB required a bean of type 'auth.user.ApplicationUserRepository' that could not be found.

Action:
Consider defining a bean of type 'auth.user.ApplicationUserRepository' in your configuration.

I have no clue what to change...

Community
  • 1
  • 1
Usr
  • 2,628
  • 10
  • 51
  • 91
  • 3
    Hello, `ApplicationUserRepository` and `UserServiceDB` are in the same "location" ? Could you please share your project structure and Spring configuration ? – Mickael Mar 15 '19 at 10:46
  • 1
    Check your CompanenScan annotation. – Habil Mar 15 '19 at 10:49
  • 1
    as Mickael said we need the directory structure. It seems your main Application class is not in the root of you project. The component scan start from the class annotate with SpringBootApplication and goes into the directory tree from there – rick Mar 15 '19 at 11:06

0 Answers0