我使用Spring云网关时遇到问题
如果任何依赖项直接或递归调用spring-boot-starter-tomcat
它将无法工作,因为它将启动嵌入式tomcat服务器而不是Spring云网关使用的netty服务器
我开始通过排除这种依赖性来解决这个问题
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
Run Code Online (Sandbox Code Playgroud)
春云网关成功运作
但有时我想使用spring-cloud-starter-oauth2来使用@ EnableOAuth2Sso
我开始使用
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-oauth2</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
Run Code Online (Sandbox Code Playgroud)
那时我面临着抛出异常的大问题
引起:java.lang.IllegalStateException:无法在类org.springframework.security.oauth2.config.annotation.web.configuration.OAuth2ClientConfiguration上内省带注释的方法......
引起:java.lang.NoClassDefFoundError:javax/servlet/Filter
Spring Boot 2 WebFlux在新版本中生成Json流
例如
@GetMapping(value = "stream", produces = APPLICATION_STREAM_JSON_VALUE)
public Flux<Data> stream() {
    return Flux.interval(Duration.ofSeconds(1)).map(Data::new);
}
Run Code Online (Sandbox Code Playgroud)
将每隔一秒产生一次新的数据
{"value":"1"}
{"value":"2"}
{"value":"3"}
{"value":"4"}
{"value":"5"}
{"value":"6"}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过angular 5 httpclient
findAll(): Observable<Data> {
   return this._http.get<Data>(this.url);
}
Run Code Online (Sandbox Code Playgroud)
但它不适合我,因为我想被反应它不会发送结果,因为它缓存结果,直到连接colsed
我想问一下在角度5中处理这个Json的最佳方法是什么
我收到 OAuth2AuthorizationException:[authorization_request_not_found]
当尝试将授权授予类型从授权代码替换为隐式时
 spring:
    security:
      oauth2:
        client:
          registration:
            mobile:
              provider: auth
              client-id: revo
              authorization-grant-type: implicit
              redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
              scope: read
Run Code Online (Sandbox Code Playgroud)
结果将我重定向到 /login/oauth2/code/mobile#access_token={++++}&token_type=bearer&state={++++}&expires_in={++++}
嗨,我在线程范围内使用 Spring Security 时遇到了一些问题
System.out.println(((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId());
new Thread(() -> System.out.println(((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId())).start();
Run Code Online (Sandbox Code Playgroud)
这两行应该给我当前的用户 ID
第一行按预期工作
第二行给我 NullPointerException 因为没有当前用户它是空值
我发现了这个问题,因为我想将许多行保存到歌曲表中,并且它包含 @CreatedBy 用户,这将要求线程中的当前用户并且会失败,因为这将为当前用户提供空值
我想更改spring boot 2的上下文路径,例如我想在http:// localhost:8080/test /上提供服务
我的意思是它不适合我使用spring-boot-starter-webflux:2.0.0.RELEASE
它只与spring-boot-starter-web :: 2.0.0.RELEASE一起使用
我试过了
server.servlet.context-path=/test
Run Code Online (Sandbox Code Playgroud)
但是我没有发生任何事情仍然在url http:// localhost:8080 /