[英]Troubleshooting spring profiles at runtime
我目前正在維護舊版代碼庫,其中在應用程序上下文中指定了以下Spring配置文件配置:
spring.profiles.active=addressbook-[usermanager|webservices],entrypoint-[form|saml]
問題是:如何閱讀本示例中為spring.profiles.active
指定的spring.profiles.active
?
我認為這里有4種可能的配置文件定義對嗎? 即:
addressbook-usermanager, entrypoint-form
addressbook-webservices, entrypoint-form
addressbook-usermanager, entrypoint-saml
addressbook-webservices, entrypoint-saml
有沒有一種方法可以打開日志記錄,以查看選擇了哪個概要文件以及為特定概要文件加載了哪些bean? 如果不是,為什么它們沒有被裝載?
我正在瀏覽此博客文章以及我可以找到的任何其他類型的文檔,但是我沒有發現任何特定於上述概要規范語法的內容。 有沒有可用的文檔?
謝謝!
我不知道Spring對上面描述的語法有任何支持。 我相信您所描述的配置將為您提供兩個活動的配置文件:
addressbook-[usermanager|webservices]
entrypoint-[form|saml]
您可以使用Environment.getActiveProfiles()
查詢當前活動的配置文件。 要掌握Environment
實例,可以使用Spring的自動裝配或實現EnvironmentAware
。
您可能還需要查看ProfileCondition
。 沒有登錄,但是您可以使用調試器根據其@Profile
注釋查看包含或排除的bean。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.