[Question] Does spring-alibaba-nacos-config support the @NacosValue annotation?
waiting-for-feedbackarea/nacos
**Which Component**
```xml
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-alibaba-nacos-config</artifactId>
<version>2025.1.0.0</version>
</dependency>
```
spring-alibaba-nacos-config + Spring Boot v4.0.6 (without any Cloud)
**Describe what problem you have encountered**
Demo Code
```java
@RestController
class UserService {
@Value(value = "${app.enable-cache}")
// @NacosConfig(group = "DEFAULT", dataId = "nacos-demo.yaml", key = "app.enable-cache")
// @NacosValue(value = "${app.enable-cache}", autoRefreshed = true)
private boolean enableCache;
@GetMapping("/info")
String getInfo() {
if (enableCache) {
return "Info for cached";
}
return "Infos";
}
}
```
`@NacosConfig` and `@Value` (None auto-refresh) work normally, but `@NacosValue` cannot be used.
**Describe what information you have read**
Initial investigation shows that `com.alibaba.cloud.nacos.annotation.NacosAnnotationProcessor` only includes listener for `@NacosConfig`, `@NacosConfigListener`, and `NacosConfigKeysListener`, but does not include the `@NacosValue` annotation.
So, my question is: does the `spring-alibaba-nacos-config` module not yet support the `@NacosValue` annotation, or is this annotation simply outside the scope of this module?
3 条评论