Skip to content

RFC: Parameter Injection #184

@vitodegiosa

Description

@vitodegiosa

Key information

  • RFC PR:
  • Related issue(s), if known:
  • Area: Parameter
  • Meet tenets: Yes

Summary

Provide an annotation based injection of parameters. A concept similar to the @value annotation in Spring, backed up by the existing providers for SSM and Secrets Manager

Motivation

This feature will make it easier and concise to retrieve and use parameters in a declarative way.

Proposal

Annotating a String field into the Lambda handler would result into the field to be populated with the value of the referenced parameter available in one of the possible providers (SSM and Secrets Manager for the time being).

It could look like this:

@Parameter(name="/powertools-java/sample/simplekey")
private String myParam;

The annotation can provide options to specify name, provider, transformation, caching

@Parameter(name="/sample/simplekey", provider="SSM", maxAge=30)
private String myParam;

Drawbacks

Why should we not do this?
Less transparency in the code

Do we need additional dependencies? Impact performance/package size?
No

Rationale and alternatives

  • What other designs have been considered? Why not them?
  • What is the impact of not doing this?

Unresolved questions

Optional, stash area for topics that need further development e.g. TBD

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions