3 ms·
>> Good alternatives to using Spring is Google and Square's Dagger library or Google's Guice. They don't use Spring's XML configuration file format, and instead
by fizwhiz 11y ago
>> Good alternatives to using Spring is Google and Square's Dagger library or Google's Guice. They don't use Spring's XML configuration file format, and instead they put the injection logic in annotations and in code
Spring has had code-based configurations since 2009[1]; seems a little disingenuous to recommend Guice/Dagger due to this non-existent limitation.
[1] http://spring.io/blog/2009/12/22/configuration-simplifications-in-spring-3-0/ http://spring.io/blog/2009/12/22/configuration-simplificatio...
- 6502nerdface 11y agoNot sure how you get that reading... the author makes no claim that Spring is limited to XML configuration. In fact, in the paragraph just before the one you quote: > It [the Spring framework] has a either code-based wiring or XML configuration-based wiring.
- fizwhiz 11y agoI read the paragraphs a little like "Spring has code-based config and xml-based config (careful with the xml-based config!) Guice and Dagger don't have xml-based config, so use Guice or Dagger". My gripe is with the hand-wavy treatment of why Guice/Dagger are better alternatives just because they don't have xml-based configs even though the author knows that people can use Spring exclusively without xml-based configs (this is why i said it was disingenuous)
- lmm 11y agoSpring has a million and one ways to do anything; that's the problem with it. Spring with a very strict, carefully enforced style guide is probably as good as Dagger or Guice. But there is a cost to maintaining and enforcing a style guide. Better to just use something that doesn't have the bad options.
- jacques_chester 11y agoThat's what Spring Boot is for. Everything is autoconfigured and set to sensible defaults. All the dependencies in the starters are levelled and guaranteed to work together. Spring Boot on Gradle is the closest thing Java has to adding lines to a Gemfile in a Ruby system. Especially when you add other Spring automagical libraries (Spring Data REST, Spring Cloud...).