cost 6894 ms
如何使 @SpringBootTest 使用外部配置文件夹(在项目根目录内)中的 application.properties?

[英]How to make @SpringBootTest use application.properties from external config folder (inside project root)?

我有一个具有以下目录结构的多模块 Spring Boot Gradle 项目 (Kotlin) 。 当我运行Application.kt文件时,它能够获取该文件(包括 IDE 和 gradle),并且运行成功。 由于我的配置文件夹在我的应用程序文件夹之外,运行我的ApplicationTests. ...

如何在不同环境下为 Docker 和 Docker-Compose 选择正确的配置文件?

[英]How to choose correct profile on different environments for Docker and Docker-Compose?

实际上我已经检查了一些这样的问题我不明白的是; 如果我更改我的 docker-compose.yml 并向其添加配置文件,那么我应该让 Dockerfile 不带配置文件吗? 例如我的 docker-compose 文件: 我会补充: 据我了解,我需要放置 3 个不同的撰写文件,并针对不同的环境使 ...

Spring:无法从 application.properties 获取价值

[英]Spring : Cannot get value from application.properties

我通过 Spring Initializr 创建了 Spring 项目,项目结构如下: 我在 application.properties 文件中定义了属性: 我将这个值注入到 MyClass 中,如下所示: ConfigBeans 定义如下: 属性demoApplication.java: 我 ...

Spring boot app放入容器后好像没有运行

[英]The Spring boot app doesn't seem to run after putting it in container

我正在尝试创建 docker 个容器,我正在尝试为 MySql 创建 1 个容器,为 Spring io 创建另一个容器。数据库容器运行正常,但 spring 引导容器在某个时间点出现并退出。 我已经搜索并尝试了很多东西,但我似乎无法解决它,我得出的结论是数据库环境或 aplication.prop ...

Application.properties 值未被命令行参数覆盖

[英]Application.properties values are not being overwritten by command line argument

我的应用程序属性中有两个属性,并试图从命令行 arguments 覆盖它们,但它没有覆盖,我检查了变量名称/等。 一切都很好,但仍然没有被覆盖。 请注意:它早些时候被覆盖突然停止了。 用于从命令行运行的命令是:java -jar myJarname.jar "--com.records=10 --c ...

线程“main”中的异常 java.lang.IllegalStateException:尝试加载配置资源“类路径资源 [application.yml]”

[英]Exception in thread "main" java.lang.IllegalStateException: Attempted to load Config resource 'class path resource [application.yml]'

每次我将 application.yml/properties 文件添加到我的 springboot 应用程序并尝试运行它时,都会生成上述错误。 虽然我不需要 application.yml 来从 intellij 运行我的应用程序,但我确实想运行相同的 jar 文件并且它会导致问题。 我试过检查 ...

为什么自动编译不适用于 spring 引导项目的 vs 代码中的 application.properties 文件?

[英]why autocomplition is not working for application.properties file in vs code for spring boot project?

我在 Visual Studio Code 中创建了一个 Spring Boot 项目。 我的问题是自动完成在我的application.settings文件中不起作用,它在项目的其他部分工作正常。 任何帮助将不胜感激。 截图在这里 ...

如何配置 quarkus 自定义 HttpAuthenticationMechanism?

[英]How to configure a quarkus custom HttpAuthenticationMechanism?

我需要一个 static 机制来验证我的发件人知道 static 令牌。 该令牌被硬编码到发送系统中。 我的 API 有一个端点/webhook ,我需要在其中对其进行验证。 这个guides/security-customization给出了一个关于如何实现自定义机制的例子,所以我实现了这个: ...

在 Springboot 中从 application.properties 文件获取属性时获取 null 值

[英]Getting null value while fetching properties from application.properties file in Springboot

目标:从我的 Java class 中的 application.properties 文件中读取属性值。 当前行为:获取 null 个值预期行为: 应用程序.properties TryValueApplication.java 尝试过:我尝试从@RestController class 中访 ...

Tomcat 10 将环境变量或属性传递给 spring 启动上下文

[英]Tomcat 10 pass Environment Variable or Property to spring boot context

好吧,我正在尝试在 tomcat 10 服务器中部署一个 spring 启动应用程序,并传递一个环境密钥。 我需要传递 jasypt 的 de“秘密”来解码我的应用程序中的密码,但我不能这样做,因为上下文通常与 spring 启动应用程序运行不同。 在我的App.java中,主厕所就像public ...

Spring Boot @Value 注解从 application.properties 中获取密钥,但在运行时不使用它

[英]Spring Boot @Value annotation picks up key from application.properties, but does not use it at run time

@Value 的价值市场在运行时没有通过。 我的代码如下所示: } 当我 hover 我的鼠标悬停在 IntelliJ 中的 ${api.key} 上时,它会显示密钥。 而且,如果我将 ${api.key} 替换为密钥本身,则一切正常。 所以 IDE 知道 ${api.key} 是来自 appl ...

为什么是 spring.jpa.properties。 Spring 引导属性中并不总是需要前缀

[英]Why spring.jpa.properties. prefix is not always required in Spring Boot properties

我学习 Spring 引导,发现在某些示例中使用前缀spring.jpa.properties的相同属性,而其他示例不使用前缀。 例如:文章解释了二级缓存https://www.baeldung.com/hibernate-second-level-cache和 autor 显示了所需属性的示例(在 ...

'maven package' 命令没有获取 externalized.properties 文件

[英]'maven package' command not picking up externalized .properties file

我正在使用 spring 引导构建后端服务。 包装类型是战争。 我将主应用程序配置外部化,包括位于项目根文件夹(pom.xml 旁边)的名为env.properties的文件中的 RSA 私钥。 在主application.properties文件中,我拥有引用env.properties文件中字段 ...

Spring Boot:是否有决定哪些静态值存储在 application.properties 文件中以及哪些值存储在 java 中的最佳实践?

[英]Spring Boot: Is there a best practice for deciding which static values to store in a application.properties file and which values to store in java?

我有一个带有多个 GUI 视图的 Spring Boot Web 应用程序。 我无法决定哪些值作为实例直接存储在 Java 类中,哪些值应该存储在 application.properties 文件中。 例如: 我正在定义检查业务对象有效性的频率间隔。 我正在为处理错误定义 ui 错误消息 ...


 
粤ICP备18138465号  © 2020-2023 STACKOOM.COM