Skip to content

object-storage.aws.enabled: true configuration results in a malformed additional bean #517

@j1m-renwick

Description

@j1m-renwick

Expected Behavior

The config documentation configuration here specifies micronaut.object-storage.aws.enabled as a boolean flag, and it defaults to true. So setting this as true in the YAML, such as:

 micronaut:
    object-storage:
      aws:
        default:
          bucket: "a.bucket.location"
        enabled: true

Should be the same as omitting it, such as:

 micronaut:
    object-storage:
      aws:
        default:
          bucket: "a.bucket.location"

Actual Behaviour

Setting the value as true in the YAML results in two AwsS3Operations beans being in scope for creation - one named "default", and one malformed one named "enabled" that has invalid configuration associated with it.

Steps To Reproduce

  1. set YAML config to include:
 micronaut:
    object-storage:
      aws:
        default:
          bucket: "a.bucket.location"
        enabled: true
  1. Copying the existing AwsS3Operations bean class, and mark it with @context for eager initialisation at startup, i.e.
@Context
@EachBean(AwsS3Configuration.class)
@Requires(condition = ToggeableCondition.class)
@Requires(beans = AwsS3Configuration.class)
@Replaces(AwsS3Operations.class)
public class AwsS3OperationsNew implements ObjectStorageOperations<
    PutObjectRequest.Builder, PutObjectResponse, DeleteObjectResponse> {

    ...rest of class here...
  1. Set a breakpoint in the constructor of the new class, and start the application. The constructor will be called twice, with one invocation including a malformed configuration bean argument named "enabled"

Environment Information

No response

Example Application

No response

Version

4.3.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions