Spring IDE 可以支持编辑多个 application.yml 文件吗?
Can Spring IDE support editing multiple application.yml files?
我正在使用 Eclipse Neon
和 Spring IDE Version 3.8.3.201612191259-RELEASE
。
每当我在 src/main/resources
下创建一个 application.yml
文件时,它会显示一个 Spring 装饰图标,并允许我看到 Spring 引导的配置(例如,请参见此处:https://docs.spring.io/sts/nan/v370/NewAndNoteworthy.html ).
对于不同的配置文件,开发人员可以通过 ---
符号为每个 spring.profiles
使用具有不同部分的单个 YAML 文件。开发人员还可以选择使用以配置文件命名的单独 YAML 文件作为名称的一部分(即 application-dev.yml
),如 link 中所述:https://www.mkyong.com/spring-boot/spring-boot-profile-based-properties-and-yaml-example/ .
Spring Boot YML Editor
提供的功能不仅对 YAML 编辑非常有用,而且还因为它允许自动完成 Spring 引导配置。有没有一种方法可以关联多个文件以供 Spring Boot YML Editor
查看,以便我可以在该编辑器中轻松编辑 application-dev.yml
等文件?我知道我可以右键单击该文件并使用 Spring Yaml Properties Editor 打开它,但是如果类似于配置 Spring Bean 支持配置文件,您也可以选择多个文件来被视为 Spring YAML 文件(或者可能查找所有 application-XXX.yml
文件并将它们关联到编辑器)。
可以在 General > Content Types
的 Eclipse 首选项中找到为内容类型 Spring Yaml Properties File
指定文件关联的位置。搜索内容类型 Yaml Content Type > Spring Yaml Properties File
。在下面的框中,您可以添加所需的文件关联。
从 Eclipse Neon 开始,您必须指定所有变体,例如application-prod.yml
、application-some-profile.yml
、...
在 Eclipse Photon 中可以使用通配符,例如application-*.yml
。详情见https://www.eclipse.org/eclipse/news/4.8/M2/
我正在使用 Eclipse Neon
和 Spring IDE Version 3.8.3.201612191259-RELEASE
。
每当我在 src/main/resources
下创建一个 application.yml
文件时,它会显示一个 Spring 装饰图标,并允许我看到 Spring 引导的配置(例如,请参见此处:https://docs.spring.io/sts/nan/v370/NewAndNoteworthy.html ).
对于不同的配置文件,开发人员可以通过 ---
符号为每个 spring.profiles
使用具有不同部分的单个 YAML 文件。开发人员还可以选择使用以配置文件命名的单独 YAML 文件作为名称的一部分(即 application-dev.yml
),如 link 中所述:https://www.mkyong.com/spring-boot/spring-boot-profile-based-properties-and-yaml-example/ .
Spring Boot YML Editor
提供的功能不仅对 YAML 编辑非常有用,而且还因为它允许自动完成 Spring 引导配置。有没有一种方法可以关联多个文件以供 Spring Boot YML Editor
查看,以便我可以在该编辑器中轻松编辑 application-dev.yml
等文件?我知道我可以右键单击该文件并使用 Spring Yaml Properties Editor 打开它,但是如果类似于配置 Spring Bean 支持配置文件,您也可以选择多个文件来被视为 Spring YAML 文件(或者可能查找所有 application-XXX.yml
文件并将它们关联到编辑器)。
可以在 General > Content Types
的 Eclipse 首选项中找到为内容类型 Spring Yaml Properties File
指定文件关联的位置。搜索内容类型 Yaml Content Type > Spring Yaml Properties File
。在下面的框中,您可以添加所需的文件关联。
从 Eclipse Neon 开始,您必须指定所有变体,例如application-prod.yml
、application-some-profile.yml
、...
在 Eclipse Photon 中可以使用通配符,例如application-*.yml
。详情见https://www.eclipse.org/eclipse/news/4.8/M2/