如何使用反射在运行时改变注释值?

如何使用反射在运行时改变注释值?

问题描述:

下面是注释。

@Before(value="execution(* class.method(**)")

使用Java反射我可以改变单一的价值诠释的价值?

Can i change the value of single value annotation using java reflection?

请建议。

你在找什么的描述可以在这里找到 。但要警惕使用这种方法,它的一些告诫的也有所说明。

The description of what you are looking for can be found here. But be wary about using such approach, some of the caveats of it are also described.

此外,注释的保留策略为运行,此

Also, the retention policy of the annotation has to be runtime, for this.

在你的问题评论的链接导致了后看起来的就像你问什么,但不同的是,它是关于一个JPA / Hibernate的注释在运行时间,其中你得到的代理的类类。

The link in the comment to your question leads to a post that looks like something you are asking about, but the difference is that it is about a JPA/Hibernate annotation where in the run-time you get a proxy class to your class.