Interested in the following question. For example, framework hibernate to read the annotations of the JPA and begins the process of creating/updating tables (etc.) as objects - I understand that all this is done with the use of Reflection. It's all happening until snowmage run code that is hosted in the main () method. This begs the question, how is the intercept, or something else to first run the code from the library, and then the entire code base?
Simple and clear article "Annotations in JAVA: an overview of the syntax and creation of their own". Start with her. At the end of the article recommendations for further study. https://habr.com/ru/post/139736/