mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 02:07:50 +08:00
spring_api.md: cleanup
This commit is contained in:
parent
720409726f
commit
1b450ba579
@ -5,37 +5,37 @@
|
|||||||
|
|
||||||
<link-summary rel="excerpt"/>
|
<link-summary rel="excerpt"/>
|
||||||
<p id="excerpt">
|
<p id="excerpt">
|
||||||
Spring API allows 3rd party plugins to re-use, integrate with, or extend existing Spring Framework support in IntelliJ IDEA Ultimate.
|
Spring API allows third party plugins to re-use, integrate with, or extend existing Spring Framework support in IntelliJ IDEA Ultimate.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Please see [Spring Framework Support](https://www.jetbrains.com/lp/intellij-frameworks/) for general feature overview.
|
Please see [Spring Framework Support](https://lp.jetbrains.com/intellij-idea-spring/) for a general feature overview.
|
||||||
|
|
||||||
A popular plugin using Spring API is [hybris integration](https://plugins.jetbrains.com/plugin/7525-hybris-integration).
|
A popular plugin using Spring API is [hybris integration](https://plugins.jetbrains.com/plugin/7525-hybris-integration).
|
||||||
|
|
||||||
To develop plugins, you will need to use _IntelliJ IDEA Ultimate Edition_ version 13.1 or higher.
|
To develop plugins, you will need to use _IntelliJ IDEA Ultimate Edition_.
|
||||||
|
|
||||||
## Setting up Project
|
## Setting up Project
|
||||||
|
|
||||||
Setup [Gradle](creating_plugin_project.md) to target IntelliJ IDEA Ultimate, then [add dependency](plugin_dependencies.md) to bundled Spring plugin with ID `com.intellij.spring`.
|
Set up [Gradle](creating_plugin_project.md) to target [IntelliJ IDEA Ultimate](idea.md), then [add dependency](plugin_dependencies.md) to the bundled Spring plugin with ID `com.intellij.spring`.
|
||||||
|
|
||||||
Please use only Spring-related functionality exposed in <path>spring-api.jar</path> (sources are provided in <path>\$IDEA_HOME\$/lib/src/src_spring-boot-openapi.zip</path>) in your plugin.
|
Please use only Spring-related functionality exposed in <path>spring-api.jar</path> (sources are provided in <path>\$IDEA_HOME\$/lib/src/src_spring-boot-openapi.zip</path>) in your plugin.
|
||||||
Using any other "internal" (implementation) classes from Spring plugin itself (<path>spring.jar</path>) is _not_ supported.
|
Using any other "internal" (implementation) classes from the Spring plugin itself (<path>spring.jar</path>) is _not_ supported.
|
||||||
|
|
||||||
### plugin.xml
|
### plugin.xml
|
||||||
Add `<depends>com.intellij.spring</depends>` to your <path>[plugin.xml](plugin_configuration_file.md)</path> to require "Spring Support" plugin to be activated.
|
Add `<depends>com.intellij.spring</depends>` to your <path>[plugin.xml](plugin_configuration_file.md)</path> to require the "Spring Support" plugin to be activated.
|
||||||
All available extension points are provided under `com.intellij.spring` prefix.
|
All available extension points are provided under the `com.intellij.spring` prefix.
|
||||||
Note that the "Spring Support" plugin itself has dependencies on a few other plugins which need to be enabled in your sandbox (see notifications on startup).
|
Note that the "Spring Support" plugin itself has dependencies on a few other plugins which need to be enabled in your sandbox (see notifications on startup).
|
||||||
|
|
||||||
## Main Concepts
|
## Main Concepts
|
||||||
A Spring facet can be attached to a Module.
|
A Spring facet can be attached to a Module.
|
||||||
Nearly all Spring functionality requires an existing and correctly setup Spring facet.
|
Nearly all Spring functionality requires an existing and correct setup Spring facet.
|
||||||
|
|
||||||
Spring facets usually contain one more user-configured or automatically provided filesets, which group a set of Spring related configuration files (XML, Code, .properties, or other configuration files).
|
Spring facets usually contain one more user-configured or automatically provided filesets, which group a set of Spring-related configuration files (XML, Code, .properties, or other configuration files).
|
||||||
|
|
||||||
A fileset usually corresponds to an actual application context configuration at runtime.
|
A fileset usually corresponds to an actual application context configuration at runtime.
|
||||||
Hierarchies can be modeled by depending on another fileset (possibly from another module).
|
Hierarchies can be modeled by depending on another fileset (possibly from another module).
|
||||||
|
|
||||||
As an API-user, you will usually prefer working with `SpringModel`, which is built on top of fileset(s).
|
As an API user, you will usually prefer working with `SpringModel`, which is built on top of fileset(s).
|
||||||
|
|
||||||
## API Updates
|
## API Updates
|
||||||
> 2017.3: `LocalXmlModel#setActiveProfiles` & `LocalAnnotationModel#setActiveProfiles` have been deprecated and will be removed in 2018.1.
|
> 2017.3: `LocalXmlModel#setActiveProfiles` & `LocalAnnotationModel#setActiveProfiles` have been deprecated and will be removed in 2018.1.
|
||||||
@ -46,7 +46,7 @@ As an API-user, you will usually prefer working with `SpringModel`, which is bui
|
|||||||
>
|
>
|
||||||
{style="note"}
|
{style="note"}
|
||||||
|
|
||||||
> Some core classes have been changed in 14(.1); please see "_Version 14(.1)_" notes for info on how to replace existing API-calls.
|
> Some core classes have been changed in 14(.1); please see "_Version 14(.1)_" notes for info on how to replace existing API calls.
|
||||||
>
|
>
|
||||||
{style="note"}
|
{style="note"}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ As an API-user, you will usually prefer working with `SpringModel`, which is bui
|
|||||||
{style="note"}
|
{style="note"}
|
||||||
|
|
||||||
### Spring Setup
|
### Spring Setup
|
||||||
To check availability of Spring/Spring Facet etc. see `com.intellij.spring.model.utils.SpringCommonUtils`.
|
To check the availability of Spring/Spring Facet, see `com.intellij.spring.model.utils.SpringCommonUtils`.
|
||||||
|
|
||||||
_2016.2_ See `com.intellij.spring.SpringLibraryUtil` to obtain information about the exact version of Spring in use.
|
_2016.2_ See `com.intellij.spring.SpringLibraryUtil` to obtain information about the exact version of Spring in use.
|
||||||
|
|
||||||
@ -67,14 +67,14 @@ _2016.2_ See `com.intellij.spring.SpringLibraryUtil` to obtain information about
|
|||||||
See `SpringManager#getSpringModel(s)...` and `com.intellij.spring.model.utils.SpringModelUtils`.
|
See `SpringManager#getSpringModel(s)...` and `com.intellij.spring.model.utils.SpringModelUtils`.
|
||||||
|
|
||||||
#### Contribute Implicit Model
|
#### Contribute Implicit Model
|
||||||
See `com.intellij.spring.SpringModelProvider` to provide implicit filesets (e.g. provided by another framework in a specific configuration file).
|
See `com.intellij.spring.SpringModelProvider` to provide implicit filesets (e.g., provided by another framework in a specific configuration file).
|
||||||
|
|
||||||
_Version 15_
|
_Version 15_
|
||||||
See `com.intellij.spring.facet.SpringAutodetectedFileSet` for a convenient base class.
|
See `com.intellij.spring.facet.SpringAutodetectedFileSet` for a convenient base class.
|
||||||
Please note that autodetected filesets cannot be edited/modified by users in Spring facet.
|
Please note that auto-detected filesets cannot be edited/modified by users in Spring facet.
|
||||||
|
|
||||||
#### Customize Implicit Models Configuration
|
#### Customize Implicit Models Configuration
|
||||||
_2017.1_ See `com.intellij.spring.facet.SpringFileSetEditorCustomization` to customize presentation and/or add extra settings/actions for specific autodetected filesets.
|
_2017.1_ See `com.intellij.spring.facet.SpringFileSetEditorCustomization` to customize presentation and/or add extra settings/actions for specific auto-detected filesets.
|
||||||
|
|
||||||
#### Contribute Implicit Beans
|
#### 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).
|
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).
|
||||||
@ -114,7 +114,7 @@ _Version 14_: implement `SpringInfrastructureBean`, such beans obtain a special
|
|||||||
All support for XML-based Spring configuration files is provided via [DOM-API](xml_dom_api.md).
|
All support for XML-based Spring configuration files is provided via [DOM-API](xml_dom_api.md).
|
||||||
|
|
||||||
#### Add Support for Additional Spring Namespace
|
#### Add Support for Additional Spring Namespace
|
||||||
See <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.customNamespaces"/></include>, registered namespace-key must match the one registered with your DOM elements via `@Namespace`.
|
See <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.customNamespaces"/></include>, the registered namespace-key must match the one registered with your DOM elements via `@Namespace`.
|
||||||
Register available elements via standard `DomExtender<Beans>` EP or `com.intellij.spring.dom.SpringCustomNamespaces#registerExtensions` (Version 14).
|
Register available elements via standard `DomExtender<Beans>` EP or `com.intellij.spring.dom.SpringCustomNamespaces#registerExtensions` (Version 14).
|
||||||
|
|
||||||
Please pay attention to `getModelVersion` and `getStubVersion` (see Javadoc).
|
Please pay attention to `getModelVersion` and `getStubVersion` (see Javadoc).
|
||||||
@ -150,39 +150,39 @@ See `com.intellij.spring.spi.SpringSpiManager`.
|
|||||||
### IDE Features
|
### IDE Features
|
||||||
|
|
||||||
#### Add Inspections to Spring Validator
|
#### Add Inspections to Spring Validator
|
||||||
Add additional inspections (e.g. for custom namespace) to Spring Validator (*Settings|Compiler|Validation*) via `com.intellij.spring.SpringInspectionsRegistry$Contributor`
|
Add additional inspections (e.g., for custom namespace) to Spring Validator (*Settings|Compiler|Validation*) via `com.intellij.spring.SpringInspectionsRegistry$Contributor`
|
||||||
in <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.inspectionsRegistryContributor"/></include>.
|
in <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.inspectionsRegistryContributor"/></include>.
|
||||||
|
|
||||||
#### Add Additional Files to Spring Validator
|
#### Add Additional Files to Spring Validator
|
||||||
_Version 14.1_
|
_Version 14.1_
|
||||||
Additional files to be processed by inspections registered with Spring Validator (e.g. specific <path>.properties</path> configuration files) can be registered via `com.intellij.spring.SpringInspectionsRegistry$AdditionalFilesContributor`
|
Additional files to be processed by inspections registered with Spring Validator (e.g., specific <path>.properties</path> configuration files) can be registered via `com.intellij.spring.SpringInspectionsRegistry$AdditionalFilesContributor`
|
||||||
|
|
||||||
#### Configure Spring Support for Other Frameworks
|
#### Configure Spring Support for Other Frameworks
|
||||||
Use `com.intellij.spring.facet.SpringConfigurator` to provide "automatic" configuration when Spring facet is added via framework wizard.
|
Use `com.intellij.spring.facet.SpringConfigurator` to provide "automatic" configuration when Spring facet is added via the framework wizard.
|
||||||
|
|
||||||
#### UI/Presentation
|
#### UI/Presentation
|
||||||
Please do not reference bean icons from `SpringApiIcons` directly, but use `SpringPresentationProvider` to re-use unified icon/bean name.
|
Please do not reference bean icons from `SpringApiIcons` directly, but use `SpringPresentationProvider` to re-use the unified icon/bean name.
|
||||||
See `SpringBeansPsiElementCellRenderer` for popup/list renderer.
|
See `SpringBeansPsiElementCellRenderer` as a popup/list renderer.
|
||||||
|
|
||||||
## Spring Boot
|
## Spring Boot
|
||||||
_2018.1_
|
_2018.1_
|
||||||
|
|
||||||
Spring Boot API allows extending/accessing Spring Boot specific support in the IDE.
|
Spring Boot API allows extending/accessing Spring Boot-specific support in the IDE.
|
||||||
|
|
||||||
> While we try to maintain compatibility, please be prepared for a less strict policy.
|
> While we try to maintain compatibility, please be prepared for a less strict policy.
|
||||||
>
|
>
|
||||||
{style="warning"}
|
{style="warning"}
|
||||||
|
|
||||||
### Setting Up
|
### Setting Up
|
||||||
[Add dependency](plugin_dependencies.md) to bundled Spring Boot plugin with ID `com.intellij.spring.boot`.
|
[Add dependency](plugin_dependencies.md) to the bundled Spring Boot plugin with ID `com.intellij.spring.boot`.
|
||||||
Sources for Spring Boot API are available in <path>\$IDEA_HOME\$/lib/src/src_spring-boot-openapi.zip</path>.
|
Sources for Spring Boot API are available in <path>\$IDEA_HOME\$/lib/src/src_spring-boot-openapi.zip</path>.
|
||||||
|
|
||||||
### Update plugin.xml
|
### Update plugin.xml
|
||||||
Add `<depends>com.intellij.spring.boot</depends>` to your <path>[plugin.xml](plugin_configuration_file.md)</path> to require "Spring Boot" plugin to be activated.
|
Add `<depends>com.intellij.spring.boot</depends>` to your <path>[plugin.xml](plugin_configuration_file.md)</path> to require the "Spring Boot" plugin to be activated.
|
||||||
All available extension points are provided under `com.intellij.spring.boot` prefix.
|
All available extension points are provided under the `com.intellij.spring.boot` prefix.
|
||||||
|
|
||||||
### Spring Boot Library
|
### Spring Boot Library
|
||||||
Use `com.intellij.spring.boot.library.SpringBootLibraryUtil` to query version and availability of common additional libraries.
|
Use `com.intellij.spring.boot.library.SpringBootLibraryUtil` to query the version and availability of common additional libraries.
|
||||||
|
|
||||||
### Custom Configuration Files Format
|
### Custom Configuration Files Format
|
||||||
`com.intellij.spring.boot.model.SpringBootModelConfigFileContributor` allows adding support for custom config file formats.
|
`com.intellij.spring.boot.model.SpringBootModelConfigFileContributor` allows adding support for custom config file formats.
|
||||||
@ -193,8 +193,8 @@ Existing `Condition` implementations can be simulated at design time in IDE via
|
|||||||
Custom `@ConditionalOn...` annotations implementing `com.intellij.spring.boot.model.autoconfigure.conditions.jam.ConditionalOnJamElement` will be added into evaluation automatically.
|
Custom `@ConditionalOn...` annotations implementing `com.intellij.spring.boot.model.autoconfigure.conditions.jam.ConditionalOnJamElement` will be added into evaluation automatically.
|
||||||
|
|
||||||
### Spring Initializr
|
### Spring Initializr
|
||||||
`com.intellij.spring.boot.initializr.SpringInitializrModuleBuilderPostTask` allows performing custom setup steps after creation of module (e.g. setup integration with build system).
|
`com.intellij.spring.boot.initializr.SpringInitializrModuleBuilderPostTask` allows performing custom setup steps after creation of the module (e.g., setup integration with a build system).
|
||||||
|
|
||||||
### Endpoint Tab
|
### Endpoint Tab
|
||||||
Use <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.boot.run.endpoint"/></include> to add custom actuator endpoint tabs.
|
Use <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.boot.run.endpoint"/></include> to add custom actuator endpoint tabs.
|
||||||
Any settings should be exposed in "Spring Boot" settings tab via <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.boot.run.endpointTabConfigurable"/></include>.
|
Any settings should be exposed in the "Spring Boot" settings tab via <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.spring.boot.run.endpointTabConfigurable"/></include>.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user