Reverting injection refactor of internal bean

In commit e9d0a5518c 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.
This commit is contained in:
rproserpio
2022-07-25 01:11:46 +02:00
committed by GitHub
parent de3dabbe44
commit 3119eb65db
@@ -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;
}