java - 在 Spring-boot 中设置默认 Activity 配置文件

标签 java spring spring-boot

如果未设置 -Dspring.profiles.active,我希望我的默认 Activity 配置文件为 production

我在 application.properties 中尝试了以下操作,但没有成功:

spring.profiles.default=production

Spring-boot 版本 = 1.3.5.RELEASE

最佳答案

您在这里所做的是将默认的 default 配置文件(如果您未指定 @Profile 注释,则在任何 bean 上使用的配置文件)为生产.

你真正需要做的是设置默认的active配置文件,这样做是这样的:

spring.profiles.active=production

关于java - 在 Spring-boot 中设置默认 Activity 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37700352/

相关文章:

api - 如何在java api中编写elasticsearch script_score

java - Bean 同时是 EJB 和 JX-RS 资源

java - 为什么 Jackson 反序列化 json 无法按顺序打印对象数组?

java - 具有在运行时创建的多个数据源的 Spring Boot 和 Spring Data 应用程序

java - 从 bean 强制 Spring 关闭的最佳方法?

spring-boot - 使用 Spring boot 时出现 403 禁止错误 - 安全

java - 有谁知道如何在 "meta-annotation"中使用 Spring 的 ImportResource 注释?

java - 为什么 Java Thread 会扭曲控制台的打印

java - 如何在 Activiti JavaDelegate 任务中访问 Spring Beans

angular - 没有 'Access-Control-Allow-Origin' 与 Spring-boot/Http call angular 2 的 Angular