java - Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberDAO': Invocation of init method failed; -
i need competence in spring-boot project. when compile spring-boot project , inject service , dao objects errors:
org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'greetingcontroller': unsatisfied dependency expressed through field 'memberservice'; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'memberserviceimpl': unsatisfied dependency expressed through field 'memberdao'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'memberdao': invocation of init method failed; nested exception java.lang.abstractmethoderror: org.springframework.data.repository.core.support.repositoryfactorysupport.gettargetrepository(lorg/springframework/data/repository/core/repositoryinformation;)ljava/lang/object; @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:588) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:88) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:366) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1225) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:552) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:483) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:197) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:759) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:866) ~[spring-context-4.3.5.release.jar:4.3.5.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:542) ~[spring-context-4.3.5.release.jar:4.3.5.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) ~[spring-boot-1.4.3.release.jar:1.4.3.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:761) [spring-boot-1.4.3.release.jar:1.4.3.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:371) [spring-boot-1.4.3.release.jar:1.4.3.release] @ org.springframework.boot.springapplication.run(springapplication.java:315) [spring-boot-1.4.3.release.jar:1.4.3.release] @ org.springframework.boot.springapplication.run(springapplication.java:1186) [spring-boot-1.4.3.release.jar:1.4.3.release] @ org.springframework.boot.springapplication.run(springapplication.java:1175) [spring-boot-1.4.3.release.jar:1.4.3.release] @ com.package.application.main(application.java:24) [classes/:na] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_92] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) ~[na:1.8.0_92] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_92] @ java.lang.reflect.method.invoke(method.java:498) ~[na:1.8.0_92] @ com.intellij.rt.execution.application.appmain.main(appmain.java:144) [idea_rt.jar:na] caused by: org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'memberserviceimpl': unsatisfied dependency expressed through field 'memberdao'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'memberdao': invocation of init method failed; nested exception java.lang.abstractmethoderror: org.springframework.data.repository.core.support.repositoryfactorysupport.gettargetrepository(lorg/springframework/data/repository/core/repositoryinformation;)ljava/lang/object; @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:588) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:88) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:366) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1225) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:552) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:483) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.config.dependencydescriptor.resolvecandidate(dependencydescriptor.java:207) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1136) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:1064) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:585) ~[spring-beans-4.3.5.release.jar:4.3.5.release] ... 24 common frames omitted caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'memberdao': invocation of init method failed; nested exception java.lang.abstractmethoderror: org.springframework.data.repository.core.support.repositoryfactorysupport.gettargetrepository(lorg/springframework/data/repository/core/repositoryinformation;)ljava/lang/object; @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1589) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:554) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:483) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.config.dependencydescriptor.resolvecandidate(dependencydescriptor.java:207) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1136) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:1064) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:585) ~[spring-beans-4.3.5.release.jar:4.3.5.release] ... 37 common frames omitted caused by: java.lang.abstractmethoderror: org.springframework.data.repository.core.support.repositoryfactorysupport.gettargetrepository(lorg/springframework/data/repository/core/repositoryinformation;)ljava/lang/object; @ org.springframework.data.repository.core.support.repositoryfactorysupport.getrepository(repositoryfactorysupport.java:199) ~[spring-data-commons-1.12.6.release.jar:na] @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.initandreturn(repositoryfactorybeansupport.java:280) ~[spring-data-commons-1.12.6.release.jar:na] @ org.springframework.data.repository.core.support.repositoryfactorybeansupport.afterpropertiesset(repositoryfactorybeansupport.java:266) ~[spring-data-commons-1.12.6.release.jar:na] @ org.springframework.data.jpa.repository.support.jparepositoryfactorybean.afterpropertiesset(jparepositoryfactorybean.java:84) ~[spring-data-jpa-1.3.3.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1648) ~[spring-beans-4.3.5.release.jar:4.3.5.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1585) ~[spring-beans-4.3.5.release.jar:4.3.5.release] ... 47 common frames omitted
pom.xml
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.springframework</groupid> <artifactid>gs-messaging-stomp-websocket</artifactid> <version>0.1.0</version> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.3.release</version> </parent> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-websocket</artifactid> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>webjars-locator</artifactid> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>sockjs-client</artifactid> <version>1.0.2</version> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>stomp-websocket</artifactid> <version>2.3.3</version> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>bootstrap</artifactid> <version>3.3.7</version> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>jquery</artifactid> <version>3.1.0</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <!--jackson--> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-annotations</artifactid> <version>2.8.0</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>2.8.7</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>2.8.7</version> </dependency> <dependency> <groupid>postgresql</groupid> <artifactid>postgresql</artifactid> <version>9.1-901-1.jdbc4</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-jpa</artifactid> <version>1.4.3.release</version> </dependency> </dependencies> <properties> <java.version>1.8</java.version> </properties> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> </plugins> </build> </project>
memberdao
public interface memberdao extends crudrepository<member, long> { }
service
public interface memberservice { iterable<member> findnearmembers(double lon, double lat, long id); } @service public class memberserviceimpl implements memberservice{ @autowired private memberdao memberdao; @transactional(readonly = true, propagation = propagation.required) @override public iterable<member> findnearmembers(double lon, double lat, long id) { //... return iter; } }
application
@springbootapplication @componentscan("com.packege") @entityscan("com.packege.domain") public class application { public static void main(string[] args) { springapplication.run(application.class, args); } }
controller
@controller public class greetingcontroller { @autowired private memberservice memberservice; //... }
any idea? in advance.
check if annotating memberservice
@service
helps!
@service public interface memberservice { iterable<member> findnearmembers(double lon, double lat, long id); }
Comments
Post a Comment