Unnecessarily alarming stack trace logged during scheduler resolution #23268
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Affects: 5.1.6.RELEASE
When booting server with TRACE logging enabled Spring prints an alarming-looking stack trace if there are multiple bean candidates of the same type. As I understand it then proceeds to resolve them by name and, in this case, succeeds. Therefore, everything works as expected but the error looks unnecessarily alarming and may trigger automated error reporting as it is an exception. Surely an exception should be raised / printed if bean resolution fails.
I suggest to log the message without the exception. Ideally explaining what is being done, for example:
No qualifying bean of type 'org.springframework.scheduling.TaskScheduler' available: expected single matching bean but found 2: taskScheduler,configWatchTaskScheduler. Will attempt to resolve by name.
Example:
The text was updated successfully, but these errors were encountered: