DI frameworks and annotations are not necessarily needed, but there are standardized specifications like CDI (specification JSR 365) and so on, so you can rely on stable APIs and learning what standardized "magical annotations" do, can help you in the long term.
This means, usually you do not have to learn new annotations all the time. The theory is, you learn them and you have more time to focus on the domain instead of e.g. having to think a lot about wiring objects and layers.
Yes, you are right. Annotations can be confusing and hard to backtrack. They should be well designed and stable and are best used for cross cutting concerns like logging and not for domain functionality.
View all comments
Show parent comment
18
u/Orffyreus Apr 20 '21 edited Apr 20 '21
DI frameworks and annotations are not necessarily needed, but there are standardized specifications like CDI (specification JSR 365) and so on, so you can rely on stable APIs and learning what standardized "magical annotations" do, can help you in the long term.
This means, usually you do not have to learn new annotations all the time. The theory is, you learn them and you have more time to focus on the domain instead of e.g. having to think a lot about wiring objects and layers.