3 ms·
The equivalent Spring @ConfigurationProperties annotation supports records. Spring also requires fewer annotations overall and none of the CDI ones.
by andor 4y ago
The equivalent Spring @ConfigurationProperties annotation supports records.
Spring also requires fewer annotations overall and none of the CDI ones.
- jillesvangurp 4y agoThere's even kofu, which largely get rid of annotations entirely in favor of declarative Kotlin DSLs. Very similar to how ktor works. I tend to use Spring this way as well. E.g. we use the router dsl rather than having annotated resource classes. Kotlin DSLs are superior to using annotations IMHO. More explicit/declarative, similarly easy to read. And it gets rid of all the builder boiler plate that you have in Java. Annotations are definitely overused in some frameworks. And debugging them is a bit tedious when the magic breaks; which tends to happen with the more complicated stuff. I've seen some spectacularly misguided things happen with e.g. the @Transactional annotation having some not quite intended side effects. I always preferred just using TransactionTemplate. That makes the transactional boundaries much more clear than junior engineers copy pasting annotations until stuff vaguel stops breaking. Which, btw. is literally what people seem to do with @Transactional. I've cleaned this up in several projects. Annotations with complicated side effects are a bad idea; especially when you need to understand what those effects are.