小编dav*_*vid的帖子

@EventListener(ApplicationReadyEvent.class) 只启动一个方法?

我正在尝试在 Spring Boot 项目启动后运行一些方法。@EventListener(ApplicationReadyEvent.class)我在项目启动后想要运行的方法上方使用注释。但它一次只启动一种方法。我想同时启动多种方法。这是 的预期行为吗@EventListener(ApplicationReadyEvent.class)

spring spring-boot

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

使用 JDBC 查询运行速度要慢得多

我有两个不同的查询,当我使用 Adminer 或 DBeaver 计时时,它们执行的时间大约相同

查询一

select * from state where state_name = 'Florida';
Run Code Online (Sandbox Code Playgroud)

当我在管理员中运行上面的查询时,它需要从

0.032秒至0.058秒

解释分析

Seq Scan on state  (cost=0.00..3981.50 rows=1 width=28) (actual time=1.787..15.047 rows=1 loops=1)
  Filter: (state_name = 'Florida'::citext)
  Rows Removed by Filter: 50
Planning Time: 0.486 ms
Execution Time: 15.779 ms
Run Code Online (Sandbox Code Playgroud)

查询二

select
    property.id as property_id ,
    full_address,
    street_address,
    street.street,
    city.city as city,
    state.state_code as state_code,
    zipcode.zipcode as zipcode
from
    property
inner join street on
    street.id = property.street_id
inner join city on
    city.id = property.city_id
inner …
Run Code Online (Sandbox Code Playgroud)

postgresql spring jdbc jdbctemplate spring-boot

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

使用 firebase-admin 时设置 FCM 高优先级

我有以下代码,它使用 firebase-admin 使用 Firebase 云消息传递发送消息

Message message = null;
message = Message.builder().putData("From", fromTel).putData("To", toTel).putData("Text", text)
            .setToken(registrationToken).build();

String response = null;
try {
    response = FirebaseMessaging.getInstance().sendAsync(message).get();
    responseEntity = new ResponseEntity<String>(HttpStatus.ACCEPTED);
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
}
System.out.println("Successfully sent message: " + response);
Run Code Online (Sandbox Code Playgroud)

上面的代码工作正常。但我需要发送“高优先级”消息,以便设备可以在打瞌睡模式下接收它们。

如何使消息成为“高优先级”?

firebase firebase-cloud-messaging

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

Appium 检查元素是否显示

我正在使用 Android 版 Appium

以下适用于单击元素

driver.findElement(By.xpath("//*[@resource-id='com.app.android:id/prelogin_signup']")).click();
Run Code Online (Sandbox Code Playgroud)

但我试图检查屏幕上是否有一个元素,并且我尝试了以下操作

if (driver.findElement(By.xpath("//*[@resource-id='com.app.android:id/prelogin_signup']")).isDisplayed()) {
    System.out.println("FOUND");
} else {
    System.out.println("NOT FOUND!");
}
Run Code Online (Sandbox Code Playgroud)

但它返回一个异常说

INFO: HTTP Status: '405' -> incorrect JSON status mapping for 'unknown error' (500 expected)
org.openqa.selenium.WebDriverException: Method is not implemented
Run Code Online (Sandbox Code Playgroud)

如何检查某个元素是否在屏幕上?

appium

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