[ https://issues.apache.org/jira/browse/CAMEL-14670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17053429#comment-17053429 ]
Luca Burgazzoli commented on CAMEL-14670: ----------------------------------------- Depending of the type of the _@PropertyInject_ target, we may have a number of strategies: - if it is an interface we can generate synthetic implementation - if there is a _configurer_ we could use it to bind properties without the need of reflection and fall-back to reflective configuration in case a _configurer_ is not available - we can use APT or a maven plugin to generate the _configurer_ > @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 > Priority: Major > 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 users can define > properties like: > {code} > minio.address = http://my-minio.com > minio.access-key = ... > minio.secret-key = ... > {code} > And receive a _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)