Java 将值发送到自定义注释,并在Spring boot中返回值的更改版本
我正在尝试更改自定义批注中的常量url。但它现在正在发挥作用。我需要在自定义注释中用一些字符串连接常量url。我不知道这是否可能 下面是我的代码: 应用程序属性Java 将值发送到自定义注释,并在Spring boot中返回值的更改版本,java,spring-boot,Java,Spring Boot,我正在尝试更改自定义批注中的常量url。但它现在正在发挥作用。我需要在自定义注释中用一些字符串连接常量url。我不知道这是否可能 下面是我的代码: 应用程序属性 my.api.key=example.com ApiKey @Value("${my.api.key}") @Retention(RetentionPolicy.RUNTIME) public @interface ApiKey { } UserController.java private String nam
my.api.key=example.com
ApiKey
@Value("${my.api.key}")
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiKey {
}
UserController.java
private String name = "/level";
@ApiKey(name)
private String myKey;
我希望myKey variabe返回为example.com/level。
我可以照原样使用example.com,但不能在自定义注释中更改它
感谢您的帮助