I have a custom Annotation Processor which is being used in a sample project. I have added the following in the pom.xml file of the sample project
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<configuration>
<annotationProcessors>
<annotationProcessor>com.******.CustomAnnotationProcessor</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<arg>-Amyarg=${project.artifactId}</arg>
</compilerArgs>
</configuration>
</plugin>
I then declare the argument in the application.properties file as follows:
@myarg@.someVal=foobar
And access it as follows “
public class TestClass {
@Value("${@myarg@.someVal}")
private String testVal;
public void testMethod(){
System.out.println(testVal);
}
}
It is working fine in Intelli J as testVal prints out to be foobar. However, in eclipse I get the following error :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testClass': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder ‘@myarg@.someVal’ in string value "${@myarg@.someVal}"
I understand that Eclipse uses its own compiler, while Maven probably uses javac. How do I get this custom annotation working for eclipse as well?