如何在IntelliJ IDEA中分离弹簧上下文 [英] How to separate spring contexts in intelliJ IDEA
问题描述
我在配置IntelliJ IDEA以开发弹簧和maven供电的应用程序时遇到问题。
I have a problem configuring IntelliJ IDEA for developing spring and maven powered application.
App有两个独立的弹簧配置用于生产和测试。在IDEA的spring facet props中,我创建了两个不同的文件集,但在配置其中一个上下文时,IDEA在代码完成时显示两个文件的变体。我怎么处理这个?
App has two separate spring configurations for production and test purposes. In spring facet props in IDEA I created two different file sets but when configuring one of contexts IDEA shows variants for both ones in code completion. How can I deal with this?
谢谢
Aleksander
Aleksander
推荐答案
唯一的选择是创建两个不同的spring配置文件集。如果在两个文件集中都定义了bean,它会将bean链接到两个文件集。显然,如果必须根据代码路径使用main / test文件集,我认为它(或任何IDE)都无法解析。希望他们能够根据代码路径(源/测试)增强sprint上下文(文件集)解析。但是对于IDE来说很难,因为在流程中主要的业务逻辑都属于主要/测试环境。
The only option is to create two different filesets of spring config. If the beans are defined in both the filesets, it would links the beans to both filesets. Obviously I don't think it (or any IDE) is capable of resolving if it has to use main/test filesets based on your code path. Hope they would enhance the sprint context(fileset) resolution based on the code path (source/test). But it would be difficult for the IDE as the main business logic falls in both main/test context during the flow.
这篇关于如何在IntelliJ IDEA中分离弹簧上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!