We are trying to access consul KV store with the below set up in bootstrap and reading it with @Value("${configvalue}") in the code.
application:
name: appname
cloud:
consul:
host: consulhost
port: 8500
config :
enabled: true
@Value("${configvalue}")
private String configvalue;
@GetMapping("/home")
private String home() { return configvalue; }
public Message<String> trans4mformat(Message<JsonNode> msg)
{
System.out.println("********Got the consul parameters-->"+configvalue);
//do transform and return Message<String>
}
<int:gateway id="inboundListener" service-interface="KafkaGateway" default-request-channel="inboundChannel" error-channel="errorChannel"/>
<int:transformer id="transform" input-channel="inboundChannel" output-channel="outboundChannel" method="trans4mformat" requires-reply="false" >
<bean id="trns4m" class="com.package.Tranformation"/>
<int:poller fixed-rate="5"/>
</int:transformer>
This works well when used inside a Rest Controller; But we have a kafka listener and an integration flow starting from it and we need to access this @Value("${configvalue}") inside transformer ? This always gives null; though we can see the value with the get HTTP call in a separate method.
This is what I was doing; now I changed this to
Now I dont see that Issue any more. Thanks