-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SONARJAVA-5294 Create rule S7185: @eventlistener methods should have one parameter #4618
Conversation
rules/S7185/java/rule.adoc
Outdated
|
||
Spring provides the `@EventListener` annotation to make a method handle some specific types of events. | ||
This allows to skip the implementation of the `ApplicationListener` interface, making it easier to handle events. | ||
However, the `@EventListener` annotation can only be used on methods that have at most one parameter, which should be the specific event that we want to handle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a line break and remove the however.
However, the `@EventListener` annotation can only be used on methods that have at most one parameter, which should be the specific event that we want to handle. | |
The `@EventListener` annotation can only be used on methods that have at most one parameter, which should be the specific event that we want to handle. |
rules/S7185/java/rule.adoc
Outdated
Spring provides the `@EventListener` annotation to make a method handle some specific types of events. | ||
This allows to skip the implementation of the `ApplicationListener` interface, making it easier to handle events. | ||
However, the `@EventListener` annotation can only be used on methods that have at most one parameter, which should be the specific event that we want to handle. | ||
For multiple types of events, we can use the `classes` argument of the annotation, and provide a list of classes of events that we want to handle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For multiple types of events, we can use the `classes` argument of the annotation, and provide a list of classes of events that we want to handle. | |
To listen to several types of events, use the `classes` argument of the `@EventListener` annotation. |
Quality Gate passed for 'rspec-tools'Issues Measures |
Quality Gate passed for 'rspec-frontend'Issues Measures |
You can preview this rule here (updated a few minutes after each push).
Review
A dedicated reviewer checked the rule description successfully for: