mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-12 06:53:42 +08:00
4.2.1
This commit is contained in:
@@ -2,7 +2,6 @@ package com.gitee.sop.servercommon.configuration;
|
||||
|
||||
import com.gitee.sop.servercommon.bean.ServiceConfig;
|
||||
import com.gitee.sop.servercommon.param.SopHandlerMethodArgumentResolver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||
|
||||
/**
|
||||
@@ -16,12 +15,11 @@ public class AlipayServiceConfiguration extends BaseServiceConfiguration {
|
||||
ServiceConfig.getInstance().setDefaultVersion("1.0");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RequestMappingHandlerAdapter requestMappingHandlerAdapter;
|
||||
|
||||
@Override
|
||||
protected void doAfter() {
|
||||
super.doAfter();
|
||||
RequestMappingHandlerAdapter requestMappingHandlerAdapter = getApplicationContext().getBean(RequestMappingHandlerAdapter.class);
|
||||
SopHandlerMethodArgumentResolver sopHandlerMethodArgumentResolver = ServiceConfig.getInstance().getMethodArgumentResolver();
|
||||
sopHandlerMethodArgumentResolver.setRequestMappingHandlerAdapter(requestMappingHandlerAdapter);
|
||||
}
|
||||
|
@@ -5,7 +5,10 @@ import com.gitee.sop.servercommon.interceptor.ServiceContextInterceptor;
|
||||
import com.gitee.sop.servercommon.message.ServiceErrorFactory;
|
||||
import com.gitee.sop.servercommon.route.ServiceRouteController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
@@ -21,14 +24,21 @@ import java.util.List;
|
||||
* @author tanghc
|
||||
*/
|
||||
@Slf4j
|
||||
public class SpringmvcConfiguration implements WebMvcConfigurer {
|
||||
public class SpringmvcConfiguration implements WebMvcConfigurer, ApplicationContextAware {
|
||||
|
||||
public static final String METADATA_SERVER_CONTEXT_PATH = "server.servlet.context-path";
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public SpringmvcConfiguration() {
|
||||
ServiceConfig.getInstance().getI18nModules().add("i18n/isp/bizerror");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// 支持swagger-bootstrap-ui首页
|
||||
@@ -86,4 +96,7 @@ public class SpringmvcConfiguration implements WebMvcConfigurer {
|
||||
ServiceErrorFactory.initMessageSource(ServiceConfig.getInstance().getI18nModules());
|
||||
}
|
||||
|
||||
public ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user