rspec/rules/S4604/java/comments-and-links.adoc

40 lines
1.9 KiB
Plaintext
Raw Normal View History

=== on 20 Apr 2018, 13:58:35 Alexandre Gigleux wrote:
Reference: \https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/EnableAutoConfiguration.html
=== on 13 Jun 2018, 17:55:11 Andrei Epure wrote:
Could this produce many False Positives? How can we tell if there is something to exclude or not?
At least in https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-auto-configuration.html#using-boot-disabling-specific-auto-configuration[the official docs], there's no recommendation to exclude. It's done on a per-need basis, and that need is quite context-specific...
=== on 13 Jun 2018, 18:02:25 Alexandre Gigleux wrote:
This rule was inspired by \https://www.alexecollins.com/spring-boot-performance/
=== on 14 Mar 2021, 10:30:46 Stéphane Nicoll wrote:
Hello,
Spring Boot developer here. The way the rule is described is quite misleading IMO, I'd be curious to understand what led you (besides that blog post) to do this.
This rule sounds like it is a mistake to have a Spring Boot application with ``++@SpringBootApplication. ++``It is the general recommended approach for most apps.
> it may load and configure beans the application will never use and therefore consume more CPU and RAM than really required.
There's quite a gap between "it may" and not recommending users to use that feature at all. A major code smell sounds like something users should pay attention. IMO, the rule the way it is described will point users in the wrong direction.
As for the recommendation of using `@Import`, that's actually inaccurate. Auto-configurations are processed at a specific point of the lifecycle of the application context and using `@Import` imports them in the user config. It can be ok for corner cases (like enabling a specific feature when it was disabled based on a condition) but that's about it. `@ImportAutoConfiguration` exists but is mostly meant for testing purposes.