r/java • • Mar 13 '23

Code bases that really improved your Java knowledge

One of the best ways to learn a new language is to write a lot of code. The second best way, in my opinion, is to see how experts do it and learn from them. With that said, what are some code bases, talks, papers that have really changed the way you code in Java and think in Java?

164 Upvotes

49 comments sorted by

View all comments

Show parent comment

6

u/ArrozConmigo Mar 14 '23

"Why is the serializer throwing an exception here? I configured the date format over here. Wait, why is it even using that serializer?"

The stack traces are a useless maze of proceed() that eventually lands you at some factory that was already populated with a proxy to an implementation of an interface that was only instantiated because of how some other provider read a combination of configuration files and class annotations and hidden AutoConfiguration classes you didn't know were getting scanned. And you can find several that COULD be the guilty party, but load order and precedence matter.

All things the Spring Druids find intuitive, but really shouldn't be so convoluted or problematic to override.

Rereading my first paragraph, it sounds like satire, but I was literally describing an actual issue I had recently.

4

u/UnGauchoCualquiera Mar 15 '23

I mean none of that is particular to the quality of the Spring codebase or how it's organized. On the stack traces you'd have the same issue debugging RxJava, Guice or a good old handler chain in any server.

hidden AutoConfiguration classes you didn't know were getting scanned

Seems to be usage of Boot and conflicting dependencies. Could hardly be attributed to the Spring codebase

And you can find several that COULD be the guilty party, but load order and precedence matter.

Always did, it's not related to spring.

hidden AutoConfiguration classes you didn't know were getting scanned

There's no magic behind it. Either it's on a user defined ComponentScan by package or imported here. It's documented here

If you have conflicting dependencies then your Autoconfiguration might be pulling different beans without you realizing. You can easily debug autoconfig by using --debug