feign.template.Expressions limit of MAX_EXPRESSION_LENGTH = 10000 added by commit 8d9fe72 should be configurable to a custom value and/or being able to be disabled by setting it to 0.

Comment From: rojae

Not sure if expressions would realistically exceed 10,000 characters, but it's something that might be worth considering.

Comment From: rojae

I found that this exception (expression is too long. Max length: 10000) doesn't occur when using Spring Cloud OpenFeign.

That's because OpenFeign builds the RequestTemplate based on annotations, and it skips the strict validation Expressions.create() that happens when calling template.uri(...) directly in Feign core. So even if the URI is longer than 10,000 characters, it doesn’t throw an error.

For reproduce the exception, need to use Feign core directly and create the template with new RequestTemplate().uri(...)

Here is reproduce code

import feign.RequestTemplate;

public class TemplateLengthTest {
    public static void main(String[] args) {
        // 10,001 expression string, occur exception "expression is too long. Max length: 10000"
        String longUri = "/{" + "A".repeat(10001) + "}";
        RequestTemplate template = new RequestTemplate();
        template.uri(longUri);
    }
}