Browse Source

修复request获取不到报错

NorthLan 6 years ago
parent
commit
ca484bd310

+ 2 - 1
zen-api/src/main/kotlin/com/gxzc/zen/logging/aop/LogRequestAspect.kt

@@ -72,7 +72,8 @@ class LogRequestAspect {
             }
         }
 
-        val attr = RequestContextHolder.getRequestAttributes() as ServletRequestAttributes
+        val attr = RequestContextHolder.getRequestAttributes() as? ServletRequestAttributes
+                ?: return joinPoint.proceed()
         val request = attr.request
 
         val requestUri = request.requestURI

+ 2 - 2
zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/TestController.kt

@@ -23,7 +23,7 @@ class TestController : BaseController() {
 
     @GetMapping("a")
     fun a() {
-        uploadService.getUploadInfoById(1L)
-//        uploadService.test()
+//        uploadService.getUploadInfoById(1L)
+        uploadService.test()
     }
 }