小编mac*_*jka的帖子

Gitlab CI 无法将 spring 应用程序连接到 postgres

我在 gitlab yml 文件中有以下阶段。

    integration-tests:
      image: mydocker-hub-id/mvn-intergration-tests-image:latest
      stage: test
      services:
        - postgres
      script:
        - export PGPASSWORD=$POSTGRES_PASSWORD
        - psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
        - cd source_code
        - pg_isready
        - mvn verify -P test-ci -DskipUTs=true
Run Code Online (Sandbox Code Playgroud)

当为命令 pg_isready 执行作业时,我有响应 5432 无响应。当从每个集成测试执行测试时,我出现错误:

org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Run Code Online (Sandbox Code Playgroud)

本阶段使用的镜像是基于postgres镜像构建的,另外安装了maven和java 11。

spring应用程序无法连接postgres服务器可能是什么问题。命令postgres --version显示正确的版本。还命令

"psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c …
Run Code Online (Sandbox Code Playgroud)

postgresql spring docker gitlab-ci

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

在角度 4 中有条件地设置属性

我想设置元素的 href 属性取决于插值的元素内容。

<div>
    <ul class="contactnav">
        <li *ngFor="let contactItem of contactItems" >
            <a class="{{ contactItem.iconBootStrap }}"  href=" {{ contactItem.contactForm.indexOf('@') }} !== -1? 'mailto:{{ contactItem.contactForm }}' : '#'" data-rel="external">
                {{ contactItem.contactForm }}
            </a>           
        </li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

如果contactItem.contactForm 包含@ 否则为值'#' 设置,我应该如何在元素中定义条件以设置href 的值?

html typescript angular

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

检查字典中的列表值是否不为空

我使用以下字典:

Dictionary<DateTime, List<string>> dictionary
Run Code Online (Sandbox Code Playgroud)

如何简单地检查值之一 - >List字符串类型是否不为空?

c# dictionary list

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

如何为 Maven 命令行附加 VM 选项

如何在 Maven 命令行中添加定义为 VM 选项的参数。在 Intellij 中我有配置

java 11 -Djasypt.encryptor.password=xxx
Run Code Online (Sandbox Code Playgroud)

当我在配置类中使用 @Value 注释读取 VM 选项时,该解决方案非常有效。

@Value("${jasypt.encryptor.password}")
private String jasyptEncryptorPassword;
Run Code Online (Sandbox Code Playgroud)

我正在使用以下命令 mvn -Djasypt.encryptor.password=xx spring-boot:run 但无法获取并出现以下错误。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jasyptConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jasypt.encryptor.password' in value "${jasypt.encryptor.password}"
Run Code Online (Sandbox Code Playgroud)

仅对于命令 java -jar 可以附加 VM 选项?

java spring maven

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

标签 统计

spring ×2

angular ×1

c# ×1

dictionary ×1

docker ×1

gitlab-ci ×1

html ×1

java ×1

list ×1

maven ×1

postgresql ×1

typescript ×1