mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
[fix]设置在web环境下才注入拦截器
This commit is contained in:
parent
8880515147
commit
45479ec2fe
@ -23,6 +23,7 @@ import io.seata.core.context.RootContext;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||||||
* And clean up Seata information after servlet method invocation in
|
* And clean up Seata information after servlet method invocation in
|
||||||
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
|
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
|
||||||
*/
|
*/
|
||||||
|
@ConditionalOnWebApplication
|
||||||
public class SeataHandlerInterceptor implements HandlerInterceptor {
|
public class SeataHandlerInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
|
|
||||||
package com.alibaba.cloud.seata.web;
|
package com.alibaba.cloud.seata.web;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiaojing
|
* @author xiaojing
|
||||||
*/
|
*/
|
||||||
|
@ConditionalOnWebApplication
|
||||||
public class SeataHandlerInterceptorConfiguration implements WebMvcConfigurer {
|
public class SeataHandlerInterceptorConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user