jq 1.5匹配一个记录,其中2个或更多键与名称和值匹配

时间:2018-03-06 13:37:30

标签: json bash jq

不太清楚如何清楚地问这个问题,但是给出了如下的递归结构。我如何使用Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2018-03-06 15:31:47.739 ERROR 14140 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kinesisMessageChannelBinder' defined in org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder]: Factory method 'kinesisMessageChannelBinder' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:214) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:155) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:155) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:111) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:238) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57) [spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at demo.KinesisApplication.main(KinesisApplication.java:38) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder]: Factory method 'kinesisMessageChannelBinder' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] ... 36 common frames omitted Caused by: java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder.<init>(KinesisMessageChannelBinder.java:83) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration.kinesisMessageChannelBinder(KinesisBinderConfiguration.java:75) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f.CGLIB$kinesisMessageChannelBinder$1(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f$$FastClassBySpringCGLIB$$2200056c.invoke(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f.kinesisMessageChannelBinder(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] ... 37 common frames omitted 2018-03-06 15:31:47.755 WARN 14140 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: Cannot perform binding, no proper implementation found 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Unregistering JMX-exposed beans 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: ordersIn 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: ordersOut 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: nullChannel 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: errorChannel 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: _org.springframework.integration.errorLogger.handler 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans 2018-03-06 15:31:47.755 INFO 14140 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' 2018-03-06 15:31:47.755 INFO 14140 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2018-03-06 15:31:47.755 INFO 14140 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 2018-03-06 15:31:47.755 INFO 14140 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 2018-03-06 15:31:47.771 INFO 14140 --- [ main] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2018-03-06 15:31:47.771 ERROR 14140 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: Cannot perform binding, no proper implementation found at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at demo.KinesisApplication.main(KinesisApplication.java:38) [classes/:na] Caused by: java.lang.IllegalStateException: Cannot perform binding, no proper implementation found at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:61) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] ... 14 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kinesisMessageChannelBinder' defined in org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder]: Factory method 'kinesisMessageChannelBinder' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance(DefaultBinderFactory.java:214) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:155) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:155) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:111) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:238) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57) ~[spring-cloud-stream-1.3.0.BUILD-20170928.175652-73.jar:1.3.0.BUILD-SNAPSHOT] ... 15 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder]: Factory method 'kinesisMessageChannelBinder' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] ... 36 common frames omitted Caused by: java.lang.NoSuchMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.<init>([Ljava/lang/String;Lorg/springframework/cloud/stream/provisioning/ProvisioningProvider;)V at org.springframework.cloud.stream.binder.kinesis.KinesisMessageChannelBinder.<init>(KinesisMessageChannelBinder.java:83) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration.kinesisMessageChannelBinder(KinesisBinderConfiguration.java:75) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f.CGLIB$kinesisMessageChannelBinder$1(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f$$FastClassBySpringCGLIB$$2200056c.invoke(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration$$EnhancerBySpringCGLIB$$7c56040f.kinesisMessageChannelBinder(<generated>) ~[spring-cloud-stream-binder-kinesis-1.0.0.BUILD-20180306.025109-72.jar:1.0.0.BUILD-SNAPSHOT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE] ... 37 common frames omitted 将两个或多个键字符串与值匹配。我不知道结果在结构中的位置。它可能是最高级别或10级深度。

walk

我想找到"children": { "ccc": [{ "id": "ddd", "des": "object d", "parent": "ccc", "other": "zzz" },{ "id": "zzz", "des": "object z", "parent": "ccc", "other" : "ddd" }] } &amp;&amp; key=id=ddd然后我想为该记录添加一个新的键/值。使用key=parent=ccc将使我匹配键的值,但不是键名本身。因此,搜索.key|match("")可能会与dddid匹配。

我尝试了几个组合,如果在bash中进行,它看起来像

match_criteria

other

new_key_value

     ((.key|match("id") and (.key|test("ddd")) 
        and 
     ((.key|match("parent") and (.key|test("ccc")) 

将匹配语句插入

+= {"newkey":"newValue"}

所以结果应该是

walk(if type == "object"
      then
        with_entries(if ..match_criteria.. )
      then ..new_key_value.. else . end)

更新 根据@peak答案中的反馈,我已经更新了代码如下

"children": {
    "ccc": [{
        "id": "ddd",
        "des": "object d",
        "parent": "ccc",
        "other": "zzz",
        "newkey": "newValue"
    },{
        "id": "zzz",
        "des": "object z",
        "parent": "ccc",
        "other":"ddd"
  }]
}

不幸的是,这仍然存在两个悬而未决的问题

a)此代码将jsonOut=$(jq 'walk(when(type == "object"; with_entries( when(any(.value[]; .id == "ddd"); .value[] += {"newkey": "newValue"} ))))' <<< ${jsonIn}) 添加到搜索条件为真的所有子项,即:{"newkey": "newValue"}&amp;&amp; id:ddd,而不仅仅是id:zzz记录

id:ddd

b)在"children": { "ccc": [{ "id": "ddd", "des": "object d", "parent": "ccc", "other": "zzz", "newkey": "newValue" },{ "id": "zzz", "des": "object z", "parent": "ccc", "other":"ddd", "newkey": "newValue" }] } 子句中添加多个部分标准。我尝试使用anyAND加入方法,但这会引发错误。

|

您能否就两个问题的语法提出建议。

UPDATE2 更好地了解when(any(.value[]; .id == "ddd" | .other == "zzz"); //no match, no value added or when((any(.value[]; .id == "ddd") AND (any(.value[]; .other == "zzz")); //error : unexpected ')', expecting $end or when(any(.value[]; .id == "ddd", .other == "zzz"); //no match, no value added 过滤器,我现在已经嵌套了这些,它似乎可以缩小结果集。但是,当匹配为真时,问题when更新两个记录仍然存在。

a)

jsonIn

jsonOut=$(jq 'walk(when(type == "object";
          with_entries(
                       when(any(.value[]; .id == "ddd");
                        when(any(.value[]; .other == "zzz");
                            .value[] += {"newkey": "newValue"}
                            )))))' <<< ${jsonIn})

jsonOut

{"children": {
    "ccc": [{
        "id": "ddd",
        "des": "object d",
        "parent": "ccc",
        "other": "zzz"
    },{
        "id": "zzz",
        "des": "object z",
        "parent": "ccc",
        "other":"ddd"
  }],
  "www": [{
        "id": "ddd",
        "des": "object d",
        "parent": "www",
        "other": "ppp"
   },{
        "id": "kkk",
        "des": "object z",
        "parent": "www",
        "other":"ddd"
  }]
}}

2 个答案:

答案 0 :(得分:1)

以下是对“更新”问题的回复:

walk(when(type == "object";
          with_entries(when(.key|test("ccc");
                            .value |= map( when(.id=="ddd";
                                      . + {"newkey": "newValue"}))))))

P.S。

将来,请遵循mcve指南:http://stackoverflow.com/help/mcve

答案 1 :(得分:0)

此处使用walk的最简单方法是将更新包含在if ... then ... else ...end的“then”部分中。为了强调和澄清这一点,并缩短解决方案,我将使用通用辅助函数when

def when(filter; action): if (filter?) // null then action else . end;

现在可以用非常简单的方式编写问题的解决方案:

walk(when(type == "object";
          with_entries(when(.key|test("ccc");
                       when(any(.value[]; .id == "ddd");
                            .value += ["ADDITIONAL"])))))

当然,您可能需要比.id ==“ddd”更高级的测试,并且您可能希望每个“ccc”对象只执行一次更新,但会使用相同的结构。

实际上,您可能还希望将上述表达式包装在def中,以便更容易参数化和维护。