0

How should I go about passing data from a Spring Boot application to a library that the application uses (a library owned and controlled by me)?

Can this be done through a class-level annotation like @GetMe(name = "foobar") ? If yes, how can the name property then be retrieved by the library and used in its Java classes? Is the Java Reflection API a must-use in this case or is there a cleaner way to fetch an annotation's values?

Pete
  • 61
  • 1
  • 7
  • Maybe AOP could help on this case with the combination of the annotation. https://www.baeldung.com/spring-aop. I believe you could easily intercept the method. – stergipe Mar 17 '22 at 13:18
  • If I were to use the example `@Around` advice, could I inject the annotation somehow into the advice method? If yes, can I pass the values from that annotation to the method that Spring AOP is executing around (the method annotated with my custom annotation) ? – Pete Mar 17 '22 at 16:34
  • I believe you could. Here is a better example: https://stackoverflow.com/a/21275958/4423575 – stergipe Mar 18 '22 at 08:10

0 Answers0