Consider defining a bean of type ' package ' in your configuration [Spring-boot]

Source: Internet
Author: User

Https://stackoverflow.com/questions/40384056/consider-defining-a-bean-of-type-package-in-your-configuration-spring-boot

Your Applicant class is not scanned it seems. By default all packages starting with the-the class where you have put'll be @SpringBootApplication scanned.

Suppose your main class "Webserviceapplication" is in "" and then all components this com.service.something fall under "is com.service.something scanned, an D " com.service.applicant " won't be scanned.

You can either restructure your packages such this "webserviceapplication" falls under a root package and all other Compon Ents becomes part of the. Root package. Or you can include @SpringBootApplication(scanBasePackages={"com.service.something","com.service.application"}) etc such this "all" components is scanned and initialized in the spring container.

Update based on Comment

If you have multiple modules-being managed by maven/gradle, all spring needs was the package to scan. You tell the spring to scan "Com.module1" and the Another module which has the IT root package name as "Com.module2", those components wont is scanned. You can even the spring to scan "com" which would then scan all the components in " com.module1. " and " com.module2. "

I am not sure if it is because I has my project broke down modules and this is what I solved my issue of not being able to Find my repositories.

@SpringBootApplication@ComponentScan({"com.delivery.request"})@EntityScan("com.delivery.domain")@EnableJpaRepositories("com.delivery.repository")

Consider defining a bean of type ' package ' in your configuration [Spring-boot]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.