小编Pra*_*ath的帖子

Vue JS:右键单击事件指令

我知道这些vue事件处理程序:

@click : mouse left-click
@dblclick : mouse double click
Run Code Online (Sandbox Code Playgroud)

什么可以是检测右键单击的处理程序/指令?需要在Vue Tree视图中实现自定义上下文菜单.

谢谢.

treeview mouseevent vue.js

19
推荐指数
1
解决办法
2万
查看次数

Springboot v2.0.0.M6 WebClient 进行多次重复的 HTTP POST 调用

我正在使用 spring-boot 版本 2.0.0.M6。我需要从 spring-boot 应用程序(例如 APP1)到另一个应用程序(播放框架)(例如 APP2)进行异步 HTTP 调用。因此,如果我需要从 APP1 到 APP2 进行 20 个不同的异步调用,APP2 会收到 20 个请求,其中很少是重复的,这意味着这些重复替换了几个不同的请求。预期的:

api/v1/call/1
api/v1/call/2
api/v1/call/3
api/v1/call/4
Run Code Online (Sandbox Code Playgroud)

实际的:

api/v1/call/1
api/v1/call/2
api/v1/call/4
api/v1/call/4
Run Code Online (Sandbox Code Playgroud)

我正在使用 spring 反应式 WebClient。

下面是 build.gradle 中的 spring boot 版本

buildscript {
ext {
    springBootVersion = '2.0.0.M6'
    //springBootVersion = '2.0.0.BUILD-SNAPSHOT'
}
repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
    maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    classpath("se.transmode.gradle:gradle-docker:1.2")


}
}
Run Code Online (Sandbox Code Playgroud)

我的 WebClient 初始化代码段

private WebClient webClient = WebClient.builder() …
Run Code Online (Sandbox Code Playgroud)

java spring-boot spring-webflux

6
推荐指数
1
解决办法
2343
查看次数

反应式 spring security 中的 OAuth2 - 无法使用提供的颁发者解析配置

我已经实现了一个基于 spring-boot 的 auth-server,oauth2 具有以下端点:

  1. /oauth/令牌
  2. /oauth/check_token
  3. /oauth/token_key

我正在尝试将此身份验证服务器集成到我的反应资源服务器之一中。尝试了以下配置:

spring:
  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: http://localhost:9001/oauth/token
      client:
        provider:
          custom-provider:
            issuer-uri: http://localhost:9001/oauth/token
            token-uri: http://localhost:9001/oauth/token
            authorization-uri: http://localhost:9001/auth/oauth/authorize
            user-info-uri: http://localhost:9001/auth/user/me
            user-name-attribute: name
        registration:
          custom-client:
            client-id: USER_CLIENT_APP
            client-secret: password
            client-name: Auth Server
            # scope: user_info
            provider: custom-provider
            # redirect-uri-template: http://localhost:8082/login/oauth2/code/
            client-authentication-method: basic
            authorization-grant-type: password
Run Code Online (Sandbox Code Playgroud)

以及下面的SecurityConfig

spring:
  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: http://localhost:9001/oauth/token
      client:
        provider:
          custom-provider:
            issuer-uri: http://localhost:9001/oauth/token
            token-uri: http://localhost:9001/oauth/token
            authorization-uri: http://localhost:9001/auth/oauth/authorize
            user-info-uri: http://localhost:9001/auth/user/me
            user-name-attribute: name
        registration:
          custom-client:
            client-id: USER_CLIENT_APP
            client-secret: password
            client-name: Auth Server …
Run Code Online (Sandbox Code Playgroud)

spring-security oauth-2.0 spring-boot reactive

6
推荐指数
1
解决办法
1万
查看次数

Springboot 中的 PowerMockito 模拟私有方法

我正在尝试在我的测试类中模拟一个私有方法,如下所示。

public String processPayment(...) {
    //some lines
    privateMethod(...);
    return "";
}

private Object privateMethod(...) {
    //some lines
    return someObject;
}
Run Code Online (Sandbox Code Playgroud)

现在我需要测试processPaymentmethod 和 mock privateMethod

我尝试创建上述类的间谍,但是当我在下面执行时会调用该方法

final DeviceCheckoutServiceImpl spyDeviceCheckoutService = spy(injectedMockBeanOfAboveClass); //@InjectMock in test class
PowerMockito.doReturn(null).when(spyDeviceCheckoutService, "privateMethod", ArgumentMatchers.anyMap()); //method gets called here
spyDeviceCheckoutService.processPayment(...); //private method isn't mocked somehow, and gets called here too
Run Code Online (Sandbox Code Playgroud)

privateMethod被称为二号线本身。还有,the privateMethod不被嘲笑。

也许我以错误的方式创建了间谍对象?不能做,spy(new DeviceCheckoutServiceImpl());因为它需要 bean 实例化。

Powermockito 版本:

compile group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.0'
compile group: 'org.powermock', name: …
Run Code Online (Sandbox Code Playgroud)

junit mockito powermock spring-boot powermockito

1
推荐指数
1
解决办法
3873
查看次数