Using Spring-API
To develop plugins integrating with Spring-API you will need to use IntelliJ IDEA Ultimate Edition version 13.1 (or higher).
Setting up IntelliJ Platform SDK
Please (re-)create a IntelliJ Platform SDK to include all minimum required files.
Alternatively, follow these steps to modify existing SDK:
- add to IntelliJ Platform SDK classpath (not to your plugin module's dependencies)
$IDEA_HOME$/plugins/spring/spring-api.jar
$IDEA_HOME$/plugins/spring/spring-api.jar
- add to IntelliJ Platform SDK sourcepath
$IDEA_HOME$/lib/src/src_spring-openapi.zip
If you use other Spring functionality (e.g. Spring EL) in your plugin, make sure to add all required JARs to your IntelliJ Platform SDK classpath to make your plugin's tests work.
plugin.xml
Add <depends>com.intellij.spring</depends>
to your plugin.xml
to require "Spring Support" plugin to be activated. Navigate to target to see all available extension points.
Note that "Spring Support" plugin itself has dependencies to a few other plugins which need to be enabled in your sandbox (see notifications on startup).
Main concepts
A Spring facet can be attached on a Module.
Spring facets usually contain one more user-configured/provided filesets, which group a set of Spring related configuration files (XML, Code or .properties files).
A fileset usually corresponds to one actual application context configuration at runtime.
Filesets can depend on other filesets (possibly in another module).
As an API-user, you will usually rather work with SpringModel (which is built on top of fileset(s)).
How do I...
Spring Model
Obtain Spring Model by file, PsiElement, ..
See SpringManager#getSpringModel(s)...
Contribute implicit model(s)
See com.intellij.spring.SpringModelProvider
to provide implicit filesets (e.g. provided by another framework in specific configuration file).
Contribute implicit beans
See com.intellij.spring.model.jam.CustomComponentsDiscoverer
or com.intellij.spring.model.SpringImplicitBeansProviderBase
to provide implicit (framework-specific) beans (e.g. "servletContext" by Spring MVC).
XML Configuration
All support for XML-based Spring configuration files is provided via DOM-API.
Add support for additional Spring namespace
See EP com.intellij.spring.dom.SpringCustomNamespaces
, registered namespace-key must match the one registered with your DOM elements via @Namespace
.
Register available elements via standard DomExtender<Beans>
EP.
Add reference to Spring Bean in my DomElement
Use the following template:
Code Configuration
IDE features
Add inspections to Spring Validator
Add additional inspections (e.g. for custom namespace) to Spring Validator (Settings|Compiler|Validation) via EP com.intellij.spring.SpringInspectionsRegistry$Contributor
.
Configure Spring support for other frameworks
Use com.intellij.spring.facet.SpringConfigurator
to provide "automatic" configuration when Spring facet is added via framework wizard.