Reputation: 1
I have the following configuration in my Spring Boot application.yml
file:
widget-proxy-route:
/my/**:
stripPrefix: 1
targetUri: bbbbbbbbb
And I have a @ConfigurationProperties
class to retrieve the widget-proxy-route
value as follows:
import jakarta.annotation.PostConstruct;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
@Configuration
@ConfigurationProperties(prefix = "widget-proxy-route")
public class RouteProperties extends HashMap<Object, RouteProperties.ProxyRoute> {
@PostConstruct
public void init() {
for(Object key : keySet()) {
System.out.println("key:" + key + ", ProxyRoute:" + this.get(key));
}
}
@Data
public static class ProxyRoute {
private String targetUri;
private Integer stripPrefix;
}
}
However, the key value I'm getting is unexpected:
/my/**
my
How can I resolve this issue?
Let me know if you'd like me to revise anything! 😊
I've tried the following approaches, but they didn't work:
widget-proxy-route:
/my/**:
stripPrefix: 1
target: bbbbbbbbb
"/my/**":
target: bbbenbbbbb
\/my\/\*\*':
target: bbbenbbbbb
\\/my\\/\\*\\*':
target: bbbenbbbbb
I attempted to modify the application.yml
configuration by adding quotes, escaping forward slashes, and using different combinations of quotes and escapes, but none of them yielded the expected result.
Upvotes: 0
Views: 58