All the Spring plugins are bundled with the IDE and enabled by default.
The Spring facet is often used in combination with Hibernate.
Spring support overview
The Spring support in IntelliJ IDEA includes:
- Complete coding assistance, including smart completion in configuration files.
- Spring-aware refactorings.
- Highlighting, inspections and quick-fixes.
- Visual Spring diagrams for viewing dependencies.
- A dedicated Spring file set editor.
- Built-in File Templates for Spring context files.
- Live Templates for beans and patterns.
Spring aspect-oriented programming (AOP) support, with full coding assistance:
- Smart code completion and highlighting.
- AspectJ-aware code completion with syntax and error highlighting.
- Numerous AspectJ-aware quick-fixes.
- Enhanced navigation with active gutter icons.
- Spring AOP inspections.
- The p-namespace support for properties definition.
- 8.0+Spring annotations support.
- Support for filters to customize scanning.
- Parsing custom Spring beans
- 8.0+Navigation for beans defined with Spring custom namespaces.
- Spring 2.5: bean() pointcut designator support.
- Find by symbol.
- Quick Javadoc (Ctrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+QCtrl+Q or Alt+Button2 ClickAlt+Button2 Click, Ctrl+Shift+Space or F2F1, Control J or Control Button2 ClickControl J or Control Button2 ClickAlt Button2 Click or F2) on bean references.
- Coding assistance for @Configuration-annotated Java classes and related annotations (@Bean, @Import and @DependsOn).
- Quick navigation from @ContextConfiguration-annotated JUnit test cases to corresponding Spring configuration files by means of active gutter icons (see the screencast).
- Support for certain Spring 3.1 features including:
- 10.5+ The c-namespace support with code completion, error highlighting, quick fixes and code generation.
Bean definition profiles support.
In addition to code completion and error highlighting, the following features are available:
- For xml files containing profile definitions (<beans profile=...), an additional status bar is provided at the top of the editor. Shown in this bar are the names of the profiles which are currently active. This bar also accommodates the controls for activating and deactivating the profiles.
- Definitions of active and inactive profiles are shown in the editor in different colors.
- Quick fixes (for found problems) are suggested only for the definitions that are currently active.
- You can search for profiles in the xml configuration files, @Profile annotations and Java code and, if necessary, perform the Rename refactoring for them.
- 10.5+ Spring Roo console which you can use right in IntelliJ IDEA, without leaving the IDE. For the Roo console to be available, the Spring facet is not required. See Working with Spring Roo Console.
Spring Security support:
- Almost all tags are supported; new Spring Security 3.1 namespace elements (e.g. <jee>, <session-management>, etc.) are supported in full. This includes code completion, navigation and the rename refactoring.
- Language injections for AOP and SQL are available.
- Spring Security OAuth 1.0 and 2.0 namespaces are supported.
See also, Spring Security Support in IntelliJ IDEA 12.
Spring Integration support (up to version 2.2):
All the existing namespaces are supported
(including AMQP, Gemfire, JPA and Redis).
Coding assistance includes code auto-completion, highlighting, quick-fixes, inspections, and navigation.
The rabbit namespace is supported out-of-the-box, simplifying the integration with AMQP.
- Language injections are available for all attributes containing Spring EL expressions (including references to header names), <groovy:script> and everything containing XPath expressions.
- The rename refactoring is supported throughout the framework.
- The Spring dependencies diagram lets you view the element dependencies and navigate to the referenced beans.
See also, Spring Integration in IntelliJ IDEA 12.
- All the existing namespaces are supported (including AMQP, Gemfire, JPA and Redis). Coding assistance includes code auto-completion, highlighting, quick-fixes, inspections, and navigation.
- Spring Batch support with the ability to download and configure the Spring Batch libraries. Coding assistance features include code completion and highlighting in XML files, and the rename refactoring. Predefined Spring EL variables and references to step-scoped beans are resolved automatically. For more information, see Support for Spring Batch in IntelliJ IDEA 12.
Spring Web Flow support:
- The Structure view is available for flow.xml.
Spring EL is fully supported in flow.xml.
This includes code completion, navigation and refactoring.
All built-in and custom attributes are available on JSP pages.
- The Navigate | Symbol option (Ctrl+Shift+Alt+NCtrl+Shift+Alt+NCtrl+Shift+Alt+NCtrl+Shift+Alt+NCtrl+Shift+Alt+NCtrl+Shift+Alt+N or Ctrl+Shift+GCtrl+Shift+Alt+NCtrl+Shift+Alt+OCtrl+Shift+Alt+NAlt Command OShift Alt Command NAlt Command O) lets you quickly navigate to any of the states. In the editor, gutter icons are provided for navigating to parent or child elements. To access a parent or child flow or subflow, you can use Navigate | Related File (Ctrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeCtrl+Alt+HomeControl Command UpAlt Command HomeControl Command Up).
- All Spring Web MVC views are accessible.
See also, Spring Web Flow Support in IntelliJ IDEA 12.
- Spring Data JPA support. See Spring Data JPA in IntelliJ IDEA 11.
When using Spring and Hibernate in a project simultaneously, the following integration features are available:
- Dedicated templates to support Hibernate in Spring configuration files.
- Hibernate-aware code completion in Spring configuration files.
Developing an application using Spring
Before you start developing a Spring application, enable the Spring support in IntelliJ IDEA.
The tasks specific to Spring application development are discussed in the following topics:
- Managing Spring Configuration Files
- Managing File Sets
- Using Spring Bean Templates
- Using Spring Bean Patterns
For general instructions, refer to IntelliJ IDEA Usage Guidelines.
Language and Framework-Specific Guidelines:
- Support for Spring Batch in IntelliJ IDEA 12
- Spring Integration in IntelliJ IDEA 12
- Spring Web Flow Support in IntelliJ IDEA 12
- Spring Security Support in IntelliJ IDEA 12
- AnnotationConfigApplicationContext support in IntelliJ IDEA 11.1
- New in IntelliJ IDEA 11: Spring 3.1 @Configuration-based contexts support
- Spring Data JPA in IntelliJ IDEA 11
- New in IntelliJ IDEA 10.5: Spring Roo console
- Spring 3.1 c-namespace in IntelliJ IDEA 10.5
- New in IntelliJ IDEA 10.5: Spring Integration support
- New in IntelliJ IDEA 10.5: Spring 3.1 bean definition profiles