Unable to set contextProgagator from application.properties
See original GitHub issueResilience4j version: 1.3.1
Java version: openjdk 11.0.2 2019-01-15
I am trying to set up resilience4ji in a SpringBootApp. I am setting up ThreadpoolBulkhead in application.properties. As part of that I am also trying to set context propagators, however the application fails to start.
application.properties
... #Other properties of ThreadPoolBulkhead over-ridden
resilience4j.thread-pool-bulkhead.configs.default.keepAliveDuration=20ms
resilience4j.thread-pool-bulkhead.configs.default.contextPropagators=com.app.MdcContextPropagator
The MdcContextPropagator is used to pass the MDC context to between threads and is implemented as below
@Component
public class MdcContextPropagator implements ContextPropagator<Map<String, String>> {
@Override
public Supplier<Optional<Map<String, String>>> retrieve() {
return () -> Optional.ofNullable(MDC.getCopyOfContextMap());
}
@Override
public Consumer<Optional<Map<String, String>>> copy() {
return (copyOfContextMap) -> copyOfContextMap.ifPresent(MDC::setContextMap);
}
@Override
public Consumer<Optional<Map<String, String>>> clear() {
return (contextMap) -> MDC.clear();
}
}
Stacktrace for application startup failure
2020-04-19T17:55:25.220+0530 WARN [main] x-b3-traceId= o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'threadPoolBulkHeadCustomizer': Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.threadPoolBulkheadRegistry' defined in class path resource [io/github/resilience4j/bulkhead/autoconfigure/RefreshScopedBulkheadAutoConfiguration.class]: Unsatisfied dependency expressed through method 'threadPoolBulkheadRegistry' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'resilience4j.thread-pool-bulkhead-io.github.resilience4j.bulkhead.autoconfigure.ThreadPoolBulkheadProperties': Could not bind properties to 'ThreadPoolBulkheadProperties' : prefix=resilience4j.thread-pool-bulkhead, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'resilience4j.thread-pool-bulkhead.configs.default' to io.github.resilience4j.common.bulkhead.configuration.ThreadPoolBulkheadConfigurationProperties$InstanceProperties
...
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'resilience4j.thread-pool-bulkhead.configs.default' to io.github.resilience4j.common.bulkhead.configuration.ThreadPoolBulkheadConfigurationProperties$InstanceProperties:
Reason: No setter found for property: context-propagators
If I remove the contextPropagator part from my application.properties file I can start the application. However I would like to use the properties file to set contextPropagator, but not possible to do
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Resilience4j context propagator not able to propagte thread ...
I am trying to migrate my circuit breaker code from Hystrix to Resilience4j. The communication is between two applications out of ...
Read more >OpenTelemetry Context Propagation | Lightstep blog
This is usually caused by failing to install instrumentation for your HTTP client or your HTTP server. The second issue is misconfigured ......
Read more >Spring Cloud Sleuth Features
1. Context Propagation. Traces connect from service to service using header propagation. The default format is B3. Similar to data formats, you can...
Read more >Spring Security Context Propagation with @Async - Baeldung
So, as you can see, inside the executor thread, our call fails with a NPE, as expected – because the Principal isn't available...
Read more >Propagators API - OpenTelemetry
Each concern creates a set of Propagators for every supported Propagator type. ... write context data to and from messages exchanged by the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I quickly added the method
Yes, a PR is welcome. Please just deprecate the old method and add a correct one.