|
|
|
@ -1,15 +1,23 @@ |
|
|
|
|
package org.anyin.gitee.shiro.controller; |
|
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.anyin.gitee.shiro.base.BusinessCodeEnum; |
|
|
|
|
import org.anyin.gitee.shiro.base.Response; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
import java.util.concurrent.Executor; |
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/log-test") |
|
|
|
|
@Slf4j |
|
|
|
|
public class LogTestController { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private Executor executor; |
|
|
|
|
|
|
|
|
|
@GetMapping("/success") |
|
|
|
|
public Response<String> success(){ |
|
|
|
|
return new Response<>("success"); |
|
|
|
@ -24,4 +32,14 @@ public class LogTestController { |
|
|
|
|
public Response<String> systemException(){ |
|
|
|
|
throw new NullPointerException("空指针异常"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/executor") |
|
|
|
|
public Response<String> executor(){ |
|
|
|
|
log.info("before executor execute"); |
|
|
|
|
executor.execute(() -> { |
|
|
|
|
log.info("this executor execute method"); |
|
|
|
|
}); |
|
|
|
|
log.info("after executor execute"); |
|
|
|
|
return new Response<>("success"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|