Skip to content

Support one-time configuration of expression parameters #1412

@hellproxy

Description

@hellproxy

Problem

Let's say I have a request template that looks like this:

@RequestLine("GET /{env}/{resource}")
void getResource(@Param("env") String env, @Param("resource") String resource);

In the application that defines this template, env is configured at startup and will only ever have 1 value (e.g. "production" or "qa") during the application's lifespan. It would make sense to not have to pass this same value into each call of getResource().

Default methods are of no help here because env still needs to be dynamically set.

Proposal

Support on-time configuration of expression parameters via configuration methods on the client interface:

@Configuration
void setEnv(@Param("env") String env);

@RequestLine("GET /{env}/{resource}")
void getResource(@Param("resource") String resource);

Implementing this is pretty easy (~150 lines).

N.B. this proposal is somewhat similar to #1359.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalProposed Specification or API change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions