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