Skip to content
Advertisement

Consider defining a bean of type ‘package’ in your configuration [Spring-Boot]

I am getting the following error:

JavaScript

I have never seen this error before but it’s odd that the @Autowire is not working. Here is the project structure:

Applicant Interface

JavaScript

ApplicantImpl

JavaScript

Now I should be able to just Autowire Applicant and be able to access, however in this case it is not working when I call it in my @RestController:

JavaScript

————————UPDATE 1———————–

I added

JavaScript

and the error went away but nothing happened. However when I commented out everything dealing with Applicant in the RestController prior to adding @ComponentScan() I was able to return a string the UI, thus meaning my RestController was working, now it is being skipped. I ugly Whitelabel Error Page now.

———————UPDATE 2——————————

I added the base package of the bean it was complaining about. Error reads:

JavaScript

I added @ComponentScan

JavaScript

—————————-Update 3———————-

adding:

JavaScript

still is complaining about my ApplicantImpl class which @Autowires my repo TApplicantRepository into it.

Advertisement

Answer

It might be because the project has been broken down into different modules.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement