Managing Spring Configuration Files
Spring configuration files contain bean definitions and other information. They are used to provide context information to the Spring framework.
IntelliJ IDEA lets you manage "traditional" XML configuration files and also
@Configuration-annotated Java classes.
Mutually-related configuration files can be arranged in file sets to make their editing more effective.
When working with the configuration files in the editor, you can generate beans, properties, dependencies, etc. using the IntelliJ IDEA's code generation feature ( Code | Generate or Alt+Insert). You can also analyze the structure of your application using the Spring dependencies diagram.
To create a new XML configuration file
In the Project tool window, select the package or directory
in which you want to create a configuration file.
Then choose File | New or press Alt+Insert.
Alternatively, right-click the package or directory, and click New.
- Select XML Configuration File and then select Spring Config. Note that, as an alternative, you can also select to create a more specific type of Spring configuration file (e.g. Spring Security).
In the New File dialog, specify the name of the configuration file and click OK.
As a result, the new configuration file is created and opened in the editor.
- If necessary, add the configuration file to a file set.
To add an XML configuration file to a file set
- Click the Configure File Set link.
If you haven't defined any XML file sets yet,
the Edit Application Context dialog opens.
Configure the file set as required and click OK.
If at least one XML file set already exists, you can add the configuration file to an existing file set or create a new file set and add the configuration file to it. To do that, select the necessary option from the Choose file set menu:
- To add the configuration file to an existing file set, select the necessary file set.
- To add the configuration file to a file set that does not yet exist, select <new file set>. Then, in the Edit Application Context dialog, configure the file set and click OK.