0

I have a usecase where i want a particular class or a spring bean to be injected in a set of classes that have a particular annotation. Basically i want a few set of methods to be added to the annotated classes.

Suppose i have a class annotated with annotation @Finders. Then i want the class to be able to use some predefined methods like findById(), findByName() etc to be available to the class and we should be able to call these functions in a static context like

User.findById() and so on.

Is there a way to inject these methods to the class using Java or Spring. Can i use reflection to do this.

Is there any other way i can get this done in java.

Ekansh Rastogi
  • 2,418
  • 2
  • 14
  • 23

0 Answers0