Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14670

@PropertyInject : support for complex - non primitive - injection

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0
    • camel-core
    • None
    • Unknown

    Description

      Camel has a @PropertyInject annotation that works for primitives but it would be nice to support complex objects so that one can write:

      @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();
      }
      

      And have minio interpreted as properties root so that users can define properties like:

      minio.address = http://my-minio.com
      minio.access-key = ...
      minio.secret-key = ...
      

      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.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              lb Luca Burgazzoli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: