From 3119eb65dbdc04467dcd103afc7790a87f86fff7 Mon Sep 17 00:00:00 2001 From: rproserpio <48475312+rproserpio@users.noreply.github.com> Date: Mon, 25 Jul 2022 01:11:46 +0200 Subject: [PATCH] Reverting injection refactor of internal bean In commit e9d0a5518cd0671d9ad0353a2c87246ef0d2061b ContentTypeHandlerManager has been changed from setter-injected to constructor-injected. However, at least with spring as the object factory, that bean was an internal bean not available from the factory, injected post construction. In the 6.0.0 implementation ContentTypeInterceptor cannot be instantiated since its dependency cannot be resolved: ``` org.springframework.beans.factory.UnsatisfiedDependencyException Error creating bean with name 'org.apache.struts2.rest.ContentTypeInterceptor': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.struts2.rest.ContentTypeHandlerManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} ``` This commit attempts to revert that change. --- .../java/org/apache/struts2/rest/ContentTypeInterceptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java index 1c49d36f8..40924fc5a 100644 --- a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java +++ b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java @@ -34,10 +34,10 @@ import java.io.InputStreamReader; */ public class ContentTypeInterceptor extends AbstractInterceptor { - private final ContentTypeHandlerManager selector; + private ContentTypeHandlerManager selector; @Inject - public ContentTypeInterceptor(ContentTypeHandlerManager selector) { + public void setContentTypeHandlerSelector(ContentTypeHandlerManager selector) { this.selector = selector; }