Luca Burgazzoli created CAMEL-14670:
---------------------------------------
Summary: @PropertyInject : support for complex - non primitive -
injection
Key: CAMEL-14670
URL: https://issues.apache.org/jira/browse/CAMEL-14670
Project: Camel
Issue Type: New Feature
Components: camel-core
Reporter: Luca Burgazzoli
Fix For: 3.2.0
Camel has a @PropertyInject annotation that works for primitives but it would
be nice to support complex objects so that one can write:
{code:java}
@BindToRegistry
public static AmazonS3 minioClient(
@PropertyInject("minio") MinioConfig config) {
var endpoint = new
AwsClientBuilder.EndpointConfiguration(config.getAddress(), "US_EAST_1");
var credentials = new BasicAWSCredentials(config.getAccessKey(),
config.getSecretKey());
var credentialsProvider = new AWSStaticCredentialsProvider(credentials);
return AmazonS3ClientBuilder
.standard()
.withEndpointConfiguration(endpoint)
.withCredentials(credentialsProvider)
.withPathStyleAccessEnabled(true)
.build();
}
{code}
And have _minio_ interpreted as properties root so that once can define
properties like:
{code}
minio.address = http://my-minio.com
minio.access-key = ...
minio.secret-key = ...
{code}
And receive an _MinioConfig_ object configured from those options as method
parameter.
As today it is possible to achieve a similar behaviour using _@BeanInject_ in
combination with https://issues.apache.org/jira/browse/CAMEL-14525 but I think
it would be nice to support such case too.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)