增加服务限流降级熔断功能

This commit is contained in:
zlt
2019-01-22 14:12:30 +08:00
parent ebdc945651
commit 1da1755a95
21 changed files with 156 additions and 68 deletions
@@ -10,7 +10,6 @@ import com.central.common.utils.SpringUtil;
import com.central.oauth.mobile.MobileAuthenticationToken;
import com.central.oauth.openid.OpenIdAuthenticationToken;
import com.central.oauth.service.impl.RedisClientDetailsService;
import com.central.oauth2.common.properties.SecurityProperties;
import com.central.oauth2.common.util.AuthUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
@@ -19,8 +18,6 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.*;
@@ -71,19 +68,15 @@ public class OAuth2Controller {
@Resource
private UserService userService;
@Autowired
private SecurityProperties securityProperties;
@Value("${test2:}")
private String test2;
@GetMapping("/oauth/test")
public String[] testNacos() {
return securityProperties.getCode().getIgnoreClientCode();
public SysUser testNacos() {
return userService.selectByUsername("admin");
}
@GetMapping("/oauth/test2")
public String test2() {
return test2;
public String testNacos2() throws InterruptedException {
Thread.sleep(5000);
return "success";
}
@ApiOperation(value = "用户名密码获取token")