Part 2: How to properly annotate your Sling models
There are two types of developers in this world: those who care about clean code and those who don’t. I like to believe that I’m part of that first group.
Throughout the projects that I’ve worked on, I’ve often seen some mad things in source code that I believe is the result of developers being either extremely lazy or not knowing any better due to a lack of knowledge/training. Here is a list of things I believe to be wrong when you create Sling models:
1. Set the defaultInjectionStrategy to optional
2. Use both SlingHttpServletRequest and Resource as adaptables
3. Use @Inject everywhere
4. No name added to the property using @Named