Idea logo

The IntelliJ IDEA Blog

The Capable & Ergonomic Java IDE by JetBrains


New Spring Beans Quick-fixes in IntelliJ IDEA 12.1

Since IntelliJ IDEA 12.1 is already available for the early preview, we can tell you now about the new features.

If you ever referenced existing beans across multiple Spring configurations, you will find the new quick-fixes very useful. Now you can change dependencies between corresponding contexts in Spring facet without leaving the editor.

Let’s say we have two Spring XML configuration files: spring-config.xml and another-spring-config.xml, where each of them is configured in its own application context in Spring facet.

Let’s reference existing bean “sampleBean” across the existing, and yet unrelated application contexts.

Notice the new quick-fix Use existing bean from context… appears when IntelliJ IDEA detects a matching bean in an existing Spring configurations.

After invoking it you will be able to choose a corresponding action from the list:

Just choose one of the available options to fix your setup automatically or use Open Spring facet settings to make changes manually.

Stay tuned to our blog for more details about the new features upcoming in IntelliJ IDEA 12.1.

Feel free to share your feedback on the discussion forum and report bugs in our issue tracker.

Develop with Pleasure!

Comments below can no longer be edited.

2 Responses to New Spring Beans Quick-fixes in IntelliJ IDEA 12.1

  1. Avatar

    Brice says:

    February 19, 2013

    Spring could automatically configure these additional facets, per tests for example reading the @ContextConfiguration location.

    Also in a spring batch application we are often overiding bean definition with dummy implementations, in order to test particular part of the flow. So it becomes pretty common to have multiple definition for the same bean id.

  2. Yann Cebron

    Yann Cebron says:

    February 19, 2013

    Brice, testing setup does not require explicit context setup since it’s determined automatically via @ContextConfiguration. If you have specific cases where it doesn’t work or the current behaviour does not match your needs, please file a request. Thanks.

Discover more