News for hackers. Stuff that matters.
Re:The Modern Java Platform – 2021 Edition by jillesvangurp on Wednesday March 17, 2021 @04:31AM (#26487966)
There's a next stage after annotations. The current thinking is to replace annotations with function calls. It makes more sense if you use Kotlin because Java is a bit verbose when you do this and in Kotlin you get to create nice DSLs. This cuts down on use of reflection and AOP magic that spring relies on and also enables native compilation. It also makes it easier to debug and it makes it much easier to understand what is going on at the price of surprisingly little verbosity. Kofu and Jafu are basically still experimental but work quite nicely https://github.com/spring-projects-experimental/spring-fu/tr...

Another trend is native compilation. Spring native just went into beta (uses the Graal compiler). That still relies on reflection but they re-engineered the internals to be more native friendly.

Spring Boot basically added the notion of autoconfiguring libraries that simply by being on the classpath self configure in a sane way. It's one of those things that makes the experience a bit more ruby on rails like. Stuff just works with minimal coding and you customise it as needed (or not, which is perfectly valid).

Compared to XML configuration, Spring has come a long way. Separating code and configuration is still a good idea with Spring but indeed not strictly enforced. @Configuration classes can take the place of XML and if you use the bean dsl, that's basically the equivalent of using XML. Only it's type checked at compile time and a bit more readable.

Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @09:55PM (#26498994)
> Stuff just works with minimal coding and you customise it as needed (or not, which is perfectly valid).

You can't though, because the usual pattern is that the classpath-based self-configurer imports a non-public class that contains all the actual configuration. So you can't customize or extend the autoconfigured version - you have to either accept it as is or replicate the entirety of it from scratch.

Re:The Modern Java Platform – 2021 Edition by jillesvangurp on Thursday March 18, 2021 @02:40AM (#26500172)
You can disable configuration classes and then set things up manually. I did this recently with the mongo driver.
Re:The Modern Java Platform – 2021 Edition by lmm on Thursday March 18, 2021 @02:48AM (#26500200)
Right, but you can't customise the automatic config. It's all or nothing - you have to either use the whole autoconfig as-is or reimplement everything that it does yourself.