Currently, I know how to do this kind of filtering using Maven:
pom.xml
<properties>
<foo>bar</foo>
</properties>
app.properties
foo=${foo}
But is it possible to do that kind of filtering, using Maven, Spring or any tool else?
MyClass.java
@MyAnnotation("${foo}") // ${foo} should get replaced at compile time
public void getData() {
return data;
}
Have you tried using an execution of the resource plugin. You can point it at your Java source and use its normal filtering, as far as I know.
http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
So, the first thing is that you route the processed java source into a special folder in the target directory. Next, you have to reconfigure the compiler plugin to NOT compile the unfiltered source, and, instead, compile the new source. Note, as with all things maven, you can configure a lot more than this.
This blog entry is useful.