小编Dav*_*nig的帖子

Wait for database connection in Spring Boot without an exception

I want to create a microservice with Spring Boot. For persistence i use a mariadb database. To wait for the database which is running in a docker container, i implemented the following code like shown here:

@Bean
    public DatabaseStartupValidator databaseStartupValidator(DataSource dataSource) {
        var dsv = new DatabaseStartupValidator();
        dsv.setDataSource(dataSource);
        dsv.setTimeout(60);
        dsv.setInterval(7);
        dsv.setValidationQuery(DatabaseDriver.MYSQL.getValidationQuery());
        return dsv;
    }
Run Code Online (Sandbox Code Playgroud)

The code is working very well, my application is now waiting for the database connection. But i get an exception at startup of the application: …

java spring exception mariadb spring-boot

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

Jenkins emailext 插件在管道脚本中具有默认主题和正文

我将 Jenkins 与电子邮件扩展插件和声明性管道一起使用。在 https://jenkinsserver/configure 中,我配置了我想在管道脚本中使用的“默认主题”和“默认内容”。当我将以下代码添加到管道脚本时,一切都工作得很好。

post {
        always {
            emailext (
                to: 'my@my.dom', 
                replyTo: 'my@my.dom', 
                subject: "foo", 
                body: "bar", 
                mimeType: 'text/html'
            );
        }
    }
Run Code Online (Sandbox Code Playgroud)

但我不想在管道脚本中指定某些内容,一切都应该使用全局配置中指定的数据来完成。当我删除所有内容并仅调用它时,emailext ();它会失败,并显示主题丢失的评论。我可以做什么来使用全局指定的默认值?

jenkins email-ext jenkins-pipeline

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