如何在IntelliJ IDEA中选择个人资料? [英] How to choose profile in IntelliJ IDEA?

查看:399
本文介绍了如何在IntelliJ IDEA中选择个人资料?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么IntelliJ IDEA打开一个消息,当我打开Spring配置文件和下拉选择一个配置文件?如果我选择关闭链接,为什么它不再出现?

Why IntelliJ IDEA opens a message when I open Spring configuration file and drop-down to choose a profile? And why it doesn't appear anymore if I choose close link?

推荐答案

当您在配置文件弹出窗口上单击关闭时,它会更改设置并禁用面板上下文。 (所以你不只是关闭它为那个文件和查看。IMHO关闭是一个有点误导的名称。我认为关闭链接应该重命名为禁用。)你可以通过回:文件>设置> [IDE设置]>编辑器>外观>显示弹簧特性面板(接近底部)

When you click "Close" on the profile pop-up, it makes a settings change and disables the panel for all spring contexts. (So you are not just closing it for that file and that viewing. IMHO "Close" is a bit of a misleading name. I think the "Close" link should be renamed to "Disable".) You can turn it back on via: File > Settings > [IDE Settings] > Editor > Appearance > "Show Spring Profiles panel" (it's near the bottom)

EDIT

这个界面中的怪癖已经让我恼火了一段时间。回答您的问题后,我花了一分钟时间打开可用性-issue-report / feature-request 来改变它。请投票。

This quirk in the UI has been annoying me for a while. Answering your question made me take a minute to open a usability -issue-report/feature-request to change it. Please vote for it.

编辑2
在您的评论中回答您的后续问题...

EDIT 2 To answer your follow up question in your comment...

此设置仅适用于IDE,并且在运行或测试代码时不会影响任何内容。相反,它不会从代码中选择任何设置。它基本上设置了你,IDEA和IDEA的检查看到。它使得只有选定配置文件中的bean在IDE中处于活动状态,这样您可以在编辑代码和配置时在配置文件之间切换,并获得该配置文件的有效表示。

The setting is for the IDE only and does not effect anything when you run or test the code. Conversely, it does not pick up any settings from your code. It basically sets what you, IDEA, and IDEA's inspections "see". It makes it so only beans from the selected profile are "active in the IDE. This way you can switch between profiles when editing your code and configurations and get a valid representation of that profile.

例如,看看下面的屏幕截图(你可能需要在单独的浏览器选项卡中打开它来查看详细信息。)在其中我有'dev'配置文件活动通过这样做,我得到以下的好处:

For example, take a look at the screenshot below. (You may have to open it in a separate browser tab to see the detail.) In it I have the 'dev' profile active. By doing that I get the following benefits:


  1. IDEA强调,它不能解析一个我试图引用的我错误地只定义在

  2. 当我触发代码完成以引用另一个bean时,IDEA只显示我的名字(例如:active)'prod'profile(或者错误可能是bean在每个配置文件中有不同的名称)请注意,它不显示'beanDefOnlyInProdProfile'bean,因为它在一个非活动的配置文件中。

在Java类中的代码完成中也是如此。注意下面的两个代码完成只显示活跃配置文件中的bean:

The same holds true in code completion when in Java Classes. Notice below the two code completions only show me beans from the active profile:

这篇关于如何在IntelliJ IDEA中选择个人资料?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆