Elasticsearch测试失败

发布于 2021-12-07 01:08:16 字数 37237 浏览 770 评论 27

Gradle ,Elasticsearch,Eclipse,SpringBoot,Junit4

2018-02-03 14:45:06.253  INFO 13896 --- [           main] org.elasticsearch.node                   : [Maggott] started
2018-02-03 14:45:06.492  INFO 13896 --- [pdateTask][T#1]] org.elasticsearch.gateway                : [Maggott] recovered [1] indices into cluster_state
2018-02-03 14:45:07.110  WARN 13896 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogController': Unsatisfied dependency expressed through field 'esBlogRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esBlogRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
2018-02-03 14:45:07.110  INFO 13896 --- [           main] s.b.a.d.e.ElasticsearchAutoConfiguration : Closing Elasticsearch client
2018-02-03 14:45:07.111  INFO 13896 --- [           main] org.elasticsearch.node                   : [Maggott] stopping ...
2018-02-03 14:45:07.201  WARN 13896 --- [][generic][T#5]] org.elasticsearch.cluster.action.shard   : [Maggott] failed to send shard started to [{Maggott}{n8ig4GYITxehvlWkeHj3rA}{local}{local[1]}{local=true}]

org.elasticsearch.transport.SendRequestTransportException: [Maggott][local[1]][internal:cluster/shard/started]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:340) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:299) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:123) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:117) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.indices.cluster.IndicesClusterStateService$2.onRecoveryDone(IndicesClusterStateService.java:661) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:156) ~[elasticsearch-2.4.6.jar:2.4.6]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
Caused by: org.elasticsearch.transport.TransportException: TransportService is closed stopped can't send request
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:320) ~[elasticsearch-2.4.6.jar:2.4.6]
    ... 8 common frames omitted

2018-02-03 14:45:07.201  WARN 13896 --- [][generic][T#6]] org.elasticsearch.cluster.action.shard   : [Maggott] failed to send shard started to [{Maggott}{n8ig4GYITxehvlWkeHj3rA}{local}{local[1]}{local=true}]

org.elasticsearch.transport.SendRequestTransportException: [Maggott][local[1]][internal:cluster/shard/started]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:340) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:299) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:123) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:117) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.indices.cluster.IndicesClusterStateService$2.onRecoveryDone(IndicesClusterStateService.java:661) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:156) ~[elasticsearch-2.4.6.jar:2.4.6]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
Caused by: org.elasticsearch.transport.TransportException: TransportService is closed stopped can't send request
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:320) ~[elasticsearch-2.4.6.jar:2.4.6]
    ... 8 common frames omitted

2018-02-03 14:45:07.204  WARN 13896 --- [][generic][T#7]] org.elasticsearch.cluster.action.shard   : [Maggott] failed to send shard started to [{Maggott}{n8ig4GYITxehvlWkeHj3rA}{local}{local[1]}{local=true}]

org.elasticsearch.transport.SendRequestTransportException: [Maggott][local[1]][internal:cluster/shard/started]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:340) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:299) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:123) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(ShardStateAction.java:117) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.indices.cluster.IndicesClusterStateService$2.onRecoveryDone(IndicesClusterStateService.java:661) ~[elasticsearch-2.4.6.jar:2.4.6]
    at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:156) ~[elasticsearch-2.4.6.jar:2.4.6]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
Caused by: org.elasticsearch.transport.TransportException: TransportService is closed stopped can't send request
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:320) ~[elasticsearch-2.4.6.jar:2.4.6]
    ... 8 common frames omitted

2018-02-03 14:45:07.227  INFO 13896 --- [           main] org.elasticsearch.node                   : [Maggott] stopped
2018-02-03 14:45:07.227  INFO 13896 --- [           main] org.elasticsearch.node                   : [Maggott] closing ...
2018-02-03 14:45:07.238  INFO 13896 --- [           main] org.elasticsearch.node                   : [Maggott] closed
2018-02-03 14:45:07.239  INFO 13896 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-02-03 14:45:07.241  INFO 13896 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
Hibernate: drop table if exists user
2018-02-03 14:45:07.286  INFO 13896 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-03 14:45:07.337 ERROR 13896 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogController': Unsatisfied dependency expressed through field 'esBlogRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esBlogRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) [spring-boot-test-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) [spring-test-4.3.13.RELEASE.jar:4.3.13.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:289) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) [spring-test-4.3.13.RELEASE.jar:4.3.13.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-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.13.RELEASE.jar:4.3.13.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:191) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) [.cp/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esBlogRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    ... 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.util.Assert.isTrue(Assert.java:92) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:96) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.query.ElasticsearchQueryMethod.<init>(ElasticsearchQueryMethod.java:39) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory$ElasticsearchQueryLookupStrategy.resolveQuery(ElasticsearchRepositoryFactory.java:110) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:451) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:224) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean.afterPropertiesSet(ElasticsearchRepositoryFactoryBean.java:67) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    ... 53 common frames omitted

2018-02-03 14:45:07.347 ERROR 13896 --- [           main] o.s.test.context.TestContextManager      : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@276438c9] to prepare test instance [com.waylau.spring.boot.blog.repository.es.EsBlogRepositoryTest@766db6f9]

java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) [spring-test-4.3.13.RELEASE.jar:4.3.13.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:289) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) [spring-test-4.3.13.RELEASE.jar:4.3.13.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-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.13.RELEASE.jar:4.3.13.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:191) [spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) [.cp/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blogController': Unsatisfied dependency expressed through field 'esBlogRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esBlogRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) ~[spring-boot-test-1.5.9.RELEASE.jar:1.5.9.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    ... 25 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esBlogRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    ... 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.waylau.spring.boot.blog.repository.es.EsBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContentContaining(java.lang.String,java.lang.String,java.lang.String)
    at org.springframework.util.Assert.isTrue(Assert.java:92) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:96) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.query.ElasticsearchQueryMethod.<init>(ElasticsearchQueryMethod.java:39) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory$ElasticsearchQueryLookupStrategy.resolveQuery(ElasticsearchRepositoryFactory.java:110) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:451) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:224) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean.afterPropertiesSet(ElasticsearchRepositoryFactoryBean.java:67) ~[spring-data-elasticsearch-2.1.9.RELEASE.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
    ... 53 common frames omitted

 

 

 

 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(27

眼泪淡了忧伤 2021-12-09 12:50:59

回复
最简答的就是try catch,把问题全部抛出

归途 2021-12-09 12:50:59

回复
@哎码 : 问题是我对测试一窍不通

哑剧 2021-12-09 12:50:56

回复
@哎码 : 问题解决了,测试时程序使用了前面的mysql数据库,就不再使用elasticsearch,所以控制台无错误报出也没有得到期望值,elasticsearch配置顺序放在了mysql前面就没问题了

鹤舞 2021-12-09 12:50:56

回复
@bboss : 问题已经解决了,谢谢推荐,有空一定使用

倾城泪 2021-12-09 12:50:56

用上面推荐的工具,估计早搞定了

柳若烟 2021-12-09 12:50:53

还是失败

这是控制台没报错

Hibernate: drop table if exists user
Hibernate: create table user (id bigint not null auto_increment, email varchar(255), name varchar(255), primary key (id))
2018-02-03 21:40:21.140  INFO 26132 --- [           main] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@1ac730cd'
2018-02-03 21:40:21.146  INFO 26132 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-02-03 21:40:22.239  INFO 26132 --- [           main] org.elasticsearch.node                   : [Caber] version[2.4.6], pid[26132], build[5376dca/2017-07-18T12:17:44Z]
2018-02-03 21:40:22.239  INFO 26132 --- [           main] org.elasticsearch.node                   : [Caber] initializing ...
2018-02-03 21:40:22.253  INFO 26132 --- [           main] org.elasticsearch.plugins                : [Caber] modules [], plugins [], sites []
2018-02-03 21:40:22.323  INFO 26132 --- [           main] org.elasticsearch.env                    : [Caber] using [1] data paths, mounts [[(C:)]], net usable_space [100.6gb], net total_space [237.8gb], spins? [unknown], types [NTFS]
2018-02-03 21:40:22.323  INFO 26132 --- [           main] org.elasticsearch.env                    : [Caber] heap size [1.7gb], compressed ordinary object pointers [true]
2018-02-03 21:40:25.794  INFO 26132 --- [           main] org.elasticsearch.node                   : [Caber] initialized
2018-02-03 21:40:25.794  INFO 26132 --- [           main] org.elasticsearch.node                   : [Caber] starting ...
2018-02-03 21:40:25.799  INFO 26132 --- [           main] org.elasticsearch.transport              : [Caber] publish_address {local[1]}, bound_addresses {local[1]}
2018-02-03 21:40:25.802  INFO 26132 --- [           main] org.elasticsearch.discovery              : [Caber] elasticsearch/3NSMctzLRwaTD3lk9oFJMA
2018-02-03 21:40:25.813  INFO 26132 --- [pdateTask][T#1]] org.elasticsearch.cluster.service        : [Caber] new_master {Caber}{3NSMctzLRwaTD3lk9oFJMA}{local}{local[1]}{local=true}, reason: local-disco-initial_connect(master)
2018-02-03 21:40:25.820  INFO 26132 --- [           main] org.elasticsearch.node                   : [Caber] started
2018-02-03 21:40:26.009  INFO 26132 --- [pdateTask][T#1]] org.elasticsearch.gateway                : [Caber] recovered [1] indices into cluster_state
2018-02-03 21:40:27.014  INFO 26132 --- [pdateTask][T#1]] o.e.cluster.routing.allocation           : [Caber] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[blog][0]] ...]).
2018-02-03 21:40:29.105  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@4ef37659: startup date [Sat Feb 03 21:40:13 CST 2018]; root of context hierarchy
2018-02-03 21:40:29.347  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto public java.lang.String com.waylau.spring.boot.blog.controller.HelloContronller.hello()
2018-02-03 21:40:29.369  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/delete/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.delete(java.lang.Long,org.springframework.ui.Model)
2018-02-03 21:40:29.369  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.list(org.springframework.ui.Model)
2018-02-03 21:40:29.370  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.view(java.lang.Long,org.springframework.ui.Model)
2018-02-03 21:40:29.370  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users],methods=[POST]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.saveOrUpdateUser(com.waylau.spring.boot.blog.domain.User)
2018-02-03 21:40:29.371  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/from],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.createForm(org.springframework.ui.Model)
2018-02-03 21:40:29.372  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/users/modify/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.waylau.spring.boot.blog.controller.UserContronller.modify(java.lang.Long,org.springframework.ui.Model)
2018-02-03 21:40:29.392  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-02-03 21:40:29.395  INFO 26132 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-02-03 21:40:29.539  INFO 26132 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-03 21:40:29.540  INFO 26132 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-03 21:40:29.723  INFO 26132 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-03 21:40:29.880  WARN 26132 --- [           main] org.thymeleaf.templatemode.TemplateMode  : [THYMELEAF][main] Unknown Template Mode 'HTML5    '. Must be one of: 'HTML', 'XML', 'TEXT', 'JAVASCRIPT', 'CSS', 'RAW'. Using default Template Mode 'HTML'.
2018-02-03 21:40:31.290  INFO 26132 --- [           main] c.w.s.b.b.r.es.EsBlogRepositoryTest      : Started EsBlogRepositoryTest in 19.104 seconds (JVM running for 20.861)
2018-02-03 21:40:33.944  INFO 26132 --- [       Thread-3] o.s.w.c.s.GenericWebApplicationContext   : Closing org.springframework.web.context.support.GenericWebApplicationContext@4ef37659: startup date [Sat Feb 03 21:40:13 CST 2018]; root of context hierarchy
2018-02-03 21:40:33.953  INFO 26132 --- [       Thread-3] s.b.a.d.e.ElasticsearchAutoConfiguration : Closing Elasticsearch client
2018-02-03 21:40:33.953  INFO 26132 --- [       Thread-3] org.elasticsearch.node                   : [Caber] stopping ...
2018-02-03 21:40:34.165  INFO 26132 --- [       Thread-3] org.elasticsearch.node                   : [Caber] stopped
2018-02-03 21:40:34.165  INFO 26132 --- [       Thread-3] org.elasticsearch.node                   : [Caber] closing ...
2018-02-03 21:40:34.177  INFO 26132 --- [       Thread-3] org.elasticsearch.node                   : [Caber] closed
2018-02-03 21:40:34.178  INFO 26132 --- [       Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-02-03 21:40:34.179  INFO 26132 --- [       Thread-3] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
Hibernate: drop table if exists user
 

辞别 2021-12-09 12:50:51

回复
个人开发者中idea应该算的上主流了,因为可以D版嘛你懂的,不过大公司一般还是eclipse比较多。

策马西风 2021-12-09 12:50:50

回复
@哎码 : 测试失败,代码在下面

谢绝鈎搭 2021-12-09 12:50:50

回复
@哎码 : 有什么关于spring boot的好书推荐吗?

反话 2021-12-09 12:50:48

回复
spring boot 目前不推荐看书,一个大问题是书的更新速度跟不上,审查制度你懂的。还是得根据官方文档来学习,并且随时关注这方面大牛的博客,吸收一些新颖的理念和技巧

背叛残局 2021-12-09 12:50:48

我在eclipse里装了阿里开发规范插件

顾忌 2021-12-09 12:50:47

我一般用idea做ide,其中有个spring data插件对spring data的支持很不错,可以帮你纠正很多不容易发现的错误,并且大部分都有提示:

你也可以在eclipse插件商店中找一款类似的插件帮助开发

倾城泪 2021-12-09 12:50:36

这个不懂

霞映澄塘 2021-12-09 12:50:34

往elasticsearch里面插入和修改文档/分页查询

醉生梦死 2021-12-09 12:50:32

试试bboss es:https://www.oschina.net/news/92906/bboss-elastic-5-0-3-9-1

导入组件

import org.frameworkset.elasticsearch.ElasticSearchHelper;
import org.frameworkset.elasticsearch.client.ClientInterface;

添加/修改文档

TAgentInfo agentInfo = (TAgentInfo) dataObj;
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();				
clientUtil.addDocument("agentinfo",//索引名称
                       "agentinfo",//索引类型
                        agentInfo);//索引数据对象
//执行查询操作
ESDatas<TAgentInfo> data //ESDatas为查询结果集对象,封装了返回的当前查询的List<TAgentInfo>结果集和符合条件的总记录数totalSize
            = clientUtil.searchList"trace-*/_search",//查询操作,查询indices trace-*中符合条件的数据
                                "queryServiceByCondition",//通过名称引用配置文件中的query dsl语句
                                traceExtraCriteria,//查询条件封装对象
                                TAgentInfo.class);//指定返回的po对象类型,po对象中的属性与indices表中的文档filed名称保持一致

TAgentInfo的结构如下:

public class TAgentInfo implements java.io.Serializable{
	private String hostname;
	@PrimaryKey //文档id,添加或者修改根据ip是否已经存在来决定
	private String ip;
	private String ports;
	private String agentId;
	private String applicationName;
	private int serviceType;
	private int pid;
	private String agentVersion;
	private String vmVersion;
	private Date startTimestampDate;
	private Date endTimestampDate;
	private long startTimestamp;
	private long endTimestamp;
	private int endStatus;
	private String serverMetaData;
	private String jvmInfo;

	
}

 

剑心龙吟 2021-12-09 12:50:29

一眼看过去好像是spring data的repository接口将你的esBlog识别成属性了,你可以试试findByTitleAndXXXXX,先试试这种是不是能跑通。如果可以跑通的话就是你接口的名称不符合spring data的规范的问题

空城仅有旧梦在 2021-12-09 12:49:03

回复
@哎码 : 不是这个原因

无边思念无边月 2021-12-09 12:48:31

回复
repository的方法名改成findDistinctByTitleContainingOrSummaryContainingOrContentContaining(xxxx)这样也运行不了?

三月梨花 2021-12-09 12:48:03

回复
@哎码 : 可以了,你真厉害

一人独醉 2021-12-09 12:47:53

 

猫性小仙女 2021-12-09 12:37:55

你看下我下面的代码

彼岸花ソ最美的依靠 2021-12-09 12:22:05

No property findDistinctEsBlogByTitle found for type EsBlog

挽清梦 2021-12-09 09:14:31

查询分页可是pageable这个参数也没传进去啊

苍暮颜 2021-12-09 07:13:50

回复
@哎码 : 增加后出现新问题 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name

无人问我粥可暖 2021-12-09 03:46:08

回复
错误信息不全

猫九 2021-12-08 13:17:36

回复
@哎码 : 回复最多200字,我下面评论了错误信息

飘过的浮云 2021-12-07 07:27:02

 Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page 

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文