我想用Spring Retry修改数据库连接的创建,以便在应用程序启动时数据库关闭时再试一次。我不想限制重试次数。我应该如何配置策略来做到这一点。
我当前的代码(我知道在这种状态下它限制为100):
SimpleRetryPolicy policy = new SimpleRetryPolicy(100, Collections.singletonMap(Exception.class, true));
// Use the policy...
RetryTemplate template = new RetryTemplate();
template.setRetryPolicy(policy);
Connection conn = template.execute(new RetryCallback<Connection, Exception>() {
public Connection doWithRetry(RetryContext context) throws Exception {
return getConnectionFactory().createConnection();
}
});
Run Code Online (Sandbox Code Playgroud)
我应该如何修改此代码?
Cucumber 无法识别 String 参数,我想将其用作货币。它只识别 int 值。(它找到步骤,因为其他步骤有效)
@When("I deposit {int} of {string}")
public void testDeposit(int value, String currency) throws ClientProtocolException, IOException {
Run Code Online (Sandbox Code Playgroud)
它显示以下错误消息:
There were undefined steps. You can implement missing steps with the snippets below:
@When("I deposit {int} of GBP")
public void i_deposit_of_GBP(Integer int1) {
// Write code here that turns the phrase above into concrete actions
throw new cucumber.api.PendingException();
}
@Then("My balance is {int} of GBP")
public void my_balance_is_of_GBP(Integer int1) {
// Write code here that turns the phrase …Run Code Online (Sandbox Code Playgroud)