1

我对微服务比较陌生,我一直在尝试使用这个概念验证应用程序,它使用Spring BootSpring Cloud.

问题是,虽然应用程序在Spring Boot 1.3.5和上运行良好Spring Cloud Brixton.RELEASE,但在升级其中任何一个时都会中断。

注册新帐户时发生错误,并给出以下错误:

status 403 reading AuthServiceClient#createUser(User); content:↵{"timestamp":1510753211255,"status":403,"error":"Forbidden","message":"Access Denied","path":"/uaa/users"}

和堆栈跟踪:

2017-11-15 15:40:11.284 ERROR 9072 --- [nio-6000-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/accounts] threw exception [Request processing failed; nested exception is feign.FeignException: status 403 reading AuthServiceClient#createUser(User); content: {"timestamp":1510753211255,"status":403,"error":"Forbidden","message":"Access Denied","path":"/uaa/users"}] with root cause

由于这似乎是一个 Feign 错误,并且AuthServiceClient.java似乎是罪魁祸首,所以我将其包括在此处:

@FeignClient(name = "auth-service")
public interface AuthServiceClient {

@RequestMapping(method = RequestMethod.POST, value = "/uaa/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
void createUser(User user);

}

由于代码没有任何更改,我不明白可能是什么原因以及如何解决此错误。

4

1 回答 1

3

显然有这个神奇的属性使它再次工作:

security.oauth2.resource.filter-order: 3 

auth-service.properties

进一步阅读: SpringBoot 1.5.x + Security + OAuth2

于 2017-11-17T09:15:50.303 回答