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

@PropertyInject : support for complex - non primitive - injection

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: