Skip to content

Get rid of per-instance logger creation [SPR-9747] #14381

@spring-projects-issues

Description

@spring-projects-issues

Patrick Linskey opened SPR-9747 and commented

The per-instance lookup turns into a call to Class.getClassLoader0() for every HandlerMethod created (which is a per-request proceeding). This patch avoids that while still maintaining compilation-level backward-compatibility. Note that this patch does change the logging semantics a bit -- third-party subclasses that use the logger will start to see their messages in the HandlerMethod namespace, and the InvocableHandlerMethod and ServletInvocableHandlerMethod log statements will be separated into their own distinct channels now. If this is a design choice, it would be possible to still avoid the slow call while preserving the logging behavior by implementing a little class => logger ConcurrentHashMap in HandlerMethod -- this should be a small cache, as it's not expected that there will be many subclasses.


Affects: 3.1.1, 3.1.2, 3.2 M2

Referenced from: commits 0a877af, 2295372

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions