Springboot Integration Elasticsearch Problems encountered

Source: Internet
Author: User

 Public Interface extends Elasticsearchrepository<esblog,string>{    Page<EsBlog>  findesblogbyKeyword (string title, string summary, string content, pageable pageable);}

/*** @Auther: Administrator * @Date: 2018/7/7/007 10:34 * @Description:*/@Document (IndexName= "blog", type = "Blog") Public classEsblogImplementsserializable{@IdPrivateString ID; PrivateString title; PrivateString Summary; PrivateString content;  PublicEsblog () {} PublicEsblog (string title, string summary, string content) { This. title =title;  This. Summary =Summary;  This. Content =content; }     PublicString getId () {returnID; }     Public voidsetId (String id) { This. ID =ID; }     PublicString GetTitle () {returntitle; }     Public voidSettitle (String title) { This. title =title; }     PublicString getsummary () {returnSummary; }     Public voidSetsummary (String summary) { This. Summary =Summary; }     PublicString getcontent () {returncontent; }     Public voidsetcontent (String content) { This. Content =content; } @Override PublicString toString () {return"esblog{" + "title=" + title + ' \ ' + ', summart= ' + summary + ' \ ' + ', CO Ntent= ' + content + ' \ ' + '} '; }}

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' Requestmappinghandleradapter ' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/webmvcautoconfiguration$ Enablewebmvcconfiguration.class]: Bean instantiation via factory method failed; Nested exception is org.springframework.beans.BeanInstantiationException:Failed to instantiate [ Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method ' Requestmappinghandleradapter ' threw exception; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Mvcconversionservice ' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ Webmvcautoconfiguration$enablewebmvcconfiguration.class]: Bean instantiation via factory method failed; Nested exception is org.springframework.beans.BeanInstantiationException:Failed to instantiate [ Org.springframework.format.support.fOrmattingconversionservice]: Factory method ' Mvcconversionservice ' threw exception; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' esblogrepository ': Invocation of the Init method failed; nested exception is Org.springfram Ework.data.mapping.PropertyReferenceException:No Property keyword found for typeesblog!
At Org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod ( constructorresolver.java:590) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod ( abstractautowirecapablebeanfactory.java:1256) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance ( abstractautowirecapablebeanfactory.java:1105) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:543) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:503) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At org.springframework.beans.factory.support.abstractbeanfactory.lambda$dogetbean$0 ( abstractbeanfactory.java:317) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:222) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:315) ~[ Spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:199) ~[ Spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:760) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:869) ~[spring-context-5.0.7.release.jar:5.0.7.release]
At Org.springframework.context.support.AbstractApplicationContext.refresh (Abstractapplicationcontext.java : 550) ~[spring-context-5.0.7.release.jar:5.0.7.release]
At Org.springframework.boot.SpringApplication.refresh (springapplication.java:759) ~[ Spring-boot-2.0.3.release.jar:2.0.3.release]
At Org.springframework.boot.SpringApplication.refreshContext (springapplication.java:395) ~[ Spring-boot-2.0.3.release.jar:2.0.3.release]
At Org.springframework.boot.SpringApplication.run (springapplication.java:327) ~[ Spring-boot-2.0.3.release.jar:2.0.3.release]
At Org.springframework.boot.test.context.SpringBootContextLoader.loadContext (Springbootcontextloader.java : 139) [Spring-boot-test-2.0.3.release.jar:2.0.3.release]
At org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal ( DEFAULTCACHEAWARECONTEXTLOADERDELEGATE.JAVA:99) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:117) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.support.DefaultTestContext.getApplicationContext ( defaulttestcontext.java:108) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary ( servlettestexecutionlistener.java:190) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance ( servlettestexecutionlistener.java:132) [Spring-test-5.0.7.release.jar:5.0.7.release]
At org.springframework.test.context.TestContextManager.prepareTestInstance (testcontextmanager.java:246) [ Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest (Springjunit4classrunner.java : 227) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.junit4.springjunit4classrunner$1.runreflectivecall ( springjunit4classrunner.java:289) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12) [junit-4.12.jar:4.12]
At Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock (Springjunit4classrunner.java : 291) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild (Springjunit4classrunner.java : 246) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild (springjunit4classrunner.java:97 ) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.junit.runners.parentrunner$3.run (parentrunner.java:290) [junit-4.12.jar:4.12]
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71) [junit-4.12.jar:4.12]
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288) [junit-4.12.jar:4.12]
At org.junit.runners.parentrunner.access$000 (parentrunner.java:58) [junit-4.12.jar:4.12]
At org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268) [junit-4.12.jar:4.12]
At Org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate ( RUNBEFORETESTCLASSCALLBACKS.JAVA:61) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate ( RUNAFTERTESTCLASSCALLBACKS.JAVA:70) [Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.junit.runners.ParentRunner.run (parentrunner.java:363) [junit-4.12.jar:4.12]
At Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run (springjunit4classrunner.java:190) [ Spring-test-5.0.7.release.jar:5.0.7.release]
At Org.junit.runner.JUnitCore.run (junitcore.java:137) [junit-4.12.jar:4.12]
At Com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs (junit4ideatestrunner.java:68) [Junit-rt.jar: NA]
At Com.intellij.rt.execution.junit.ideatestrunner$repeater.startrunnerwithargs (IdeaTestRunner.java:47) [ Junit-rt.jar:na]
At Com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart (junitstarter.java:242) [Junit-rt.jar: NA]
At Com.intellij.rt.execution.junit.JUnitStarter.main (junitstarter.java:70) [Junit-rt.jar:na]
caused By:org.springframework.beans.BeanInstantiationException:Failed to instantiate [ Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method ' Requestmappinghandleradapter ' threw exception; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Mvcconversionservice ' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ Webmvcautoconfiguration$enablewebmvcconfiguration.class]: Bean instantiation via factory method failed; Nested exception is org.springframework.beans.BeanInstantiationException:Failed to instantiate [ Org.springframework.format.support.FormattingConversionService]: Factory method ' Mvcconversionservice ' threw exception Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Esblogrepository ': Invocation of Init method failed; Nested exception is Org.springframework.data.mapping.PropertyReferencEexception:no Property keyword found for type esblog!
At Org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate ( simpleinstantiationstrategy.java:185) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
At Org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod ( constructorresolver.java:582) ~[spring-beans-5.0.7.release.jar:5.0.7.release]
... Common frames omitted

Reason:

Elasticsearchrepository inheriting Springdata's Pagingandsortingrepository interface
So according to the JPA specification Findesblogbykeyword this method will find Esblog under the Keyword property ...
Change the method name to Finddistinctesblogbytitlecontainingorsummarycontainingorcontentcontaining.

Springboot Integration Elasticsearch Problems encountered

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.