Below is I want to scan the dao and the service, but has been an error, since the start of a see be wrong ReadingListRepository didn't scan to class, this class inherits JpaRepository
The 22:45:57 2017-04-25. 7864-349 WARN [main] ationConfigEmbeddedWebApplicationContext: Exception encountered during the context initialization - cancelling refresh attempt: org. Springframework. Beans. Factory. UnsatisfiedDependencyException: Error creating bean with the name 'readingListController: Unsatisfied dependency expressed through field' readingListRepository '; Nested exception is org. Springframework. Beans. Factory. NoSuchBeanDefinitionException: No qualifying bean of type 'org. Dawn. Oket. Dao. ReadingListRepository' available: expected at further 1 bean which qualifies as autowire candidate. The Dependency annotations: {@ org. Springframework. Beans. Factory. The annotation, Autowired (required=true)}
The 2017-04-25 22:45:57. 7864-349 the INFO [main] j.L ocalContainerEntityManagerFactoryBean: Closing the JPA EntityManagerFactory for persistence unit 'default'
The 2017-04-25 22:45:57. 7864-349 the INFO [main] org. Hibernate. Tool. Hbm2ddl. The SchemaExport: HHH000227: Running hbm2ddl schema export
The 2017-04-25 22:45:57. 7864-349 the INFO [main] org. Hibernate. Tool. Hbm2ddl. The SchemaExport: HHH000230: Schema export complete
The 22:45:57 2017-04-25. 7864-359 the INFO [main] o.a pache, catalina. Core. StandardService: Stopping the service Tomcat
The 2017-04-25 22:45:57. 7864-399 the INFO [main] utoConfigurationReportLoggingInitializer:
Error starting ApplicationContext. To display the auto - the configuration report re - run your application with 'debug' enabled.
The 2017-04-25 22:45:57. ERROR 681-7864 [main] O.S.B.D.L oggingFailureAnalysisReporter:
* * * * * * * * * * * * * * * * * * * * * * * * * * *
The APPLICATION FAILED TO START
* * * * * * * * * * * * * * * * * * * * * * * * * * *
Description:
Field readingListRepository in org. Dawn. Oket. Service. ReadingListController required a bean of type 'org. Dawn. Oket. Dao. ReadingListRepository' that could not be found.
Action:
Consider defining a bean of type 'org. Dawn. Oket. Dao. ReadingListRepository' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:52934, transport:' socket '
The Process finished with exit code 1
CodePudding user response:
This annotation scanning the bag under the class, and at the same level of class package, if there are other different parent-child bag, can use basePackage assigned specific package, recommend will launch a class in the top of the bagCodePudding user response:
The building Lord, please the problem solved? I also encountered this problem, and made several days, said online folder location, scanning type of these methods are tried, still won't doCodePudding user response:
@ EnableJpaRepositoriesCodePudding user response:
The Repository class, add annotations: @ the RepositoryCodePudding user response:
Put you start the class on the top of the packageCodePudding user response:
ReadingListRepository this into ordinary Java classes, do not use interface, then add @ in the class above ServiceCodePudding user response:
Don't write application in common, and write outCodePudding user response:
Location is put in wrongly, the @ ComponentScan on @ SpringBootApplication top lineCodePudding user response:
No annotations to add annotationsCodePudding user response:
@ ComponentScan basePackages specified or not,