Implemented hack to eliminate bean @Autowiring circular references
This commit is contained in:
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
@@ -21,15 +22,15 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
|||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class CommandSideWebAccountsConfiguration extends WebMvcConfigurerAdapter {
|
public class CommandSideWebAccountsConfiguration extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
class FakeThing {}
|
||||||
private RequestMappingHandlerAdapter adapter;
|
|
||||||
|
|
||||||
@PostConstruct
|
@Bean
|
||||||
public void init() {
|
public FakeThing init(RequestMappingHandlerAdapter adapter) {
|
||||||
// https://jira.spring.io/browse/SPR-13083
|
// https://jira.spring.io/browse/SPR-13083
|
||||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
||||||
handlers.add(0, new ObservableReturnValueHandler());
|
handlers.add(0, new ObservableReturnValueHandler());
|
||||||
adapter.setReturnValueHandlers(handlers);
|
adapter.setReturnValueHandlers(handlers);
|
||||||
|
return new FakeThing();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
@@ -21,15 +22,15 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
|||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class QuerySideWebConfiguration extends WebMvcConfigurerAdapter {
|
public class QuerySideWebConfiguration extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
class FakeThing {}
|
||||||
private RequestMappingHandlerAdapter adapter;
|
|
||||||
|
|
||||||
@PostConstruct
|
@Bean
|
||||||
public void init() {
|
public FakeThing init(RequestMappingHandlerAdapter adapter) {
|
||||||
// https://jira.spring.io/browse/SPR-13083
|
// https://jira.spring.io/browse/SPR-13083
|
||||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
||||||
handlers.add(0, new ObservableReturnValueHandler());
|
handlers.add(0, new ObservableReturnValueHandler());
|
||||||
adapter.setReturnValueHandlers(handlers);
|
adapter.setReturnValueHandlers(handlers);
|
||||||
|
return new FakeThing();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
@@ -21,15 +22,15 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
|||||||
@ComponentScan
|
@ComponentScan
|
||||||
public class CommandSideWebTransactionsConfiguration extends WebMvcConfigurerAdapter {
|
public class CommandSideWebTransactionsConfiguration extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
class FakeThing {}
|
||||||
private RequestMappingHandlerAdapter adapter;
|
|
||||||
|
|
||||||
@PostConstruct
|
@Bean
|
||||||
public void init() {
|
public FakeThing init(RequestMappingHandlerAdapter adapter) {
|
||||||
// https://jira.spring.io/browse/SPR-13083
|
// https://jira.spring.io/browse/SPR-13083
|
||||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
|
||||||
handlers.add(0, new ObservableReturnValueHandler());
|
handlers.add(0, new ObservableReturnValueHandler());
|
||||||
adapter.setReturnValueHandlers(handlers);
|
adapter.setReturnValueHandlers(handlers);
|
||||||
|
return new FakeThing();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user