标签: java annotations properties
我想在我的注释中访问属性值,作为属性的值。
对于前。在我的属性文件中,我有一个条目表达式:3/10 * * * * ?。
3/10 * * * * ?
在我的Scheduler类中,我使用注释@Scheduled (cron = "**VALUE**")。我想从与表达式键对应的属性文件中读取该值。
@Scheduled (cron = "**VALUE**")
尝试使用@Value执行此操作,但返回的Value类型无法转换为String。
@Value
Value
String
答案 0 :(得分:0)
您可以尝试使用APT(注释处理工具)将注释中的值替换为属性文件中的值。