IntelliJ IDEA 2022.2 Help

Spring Boot run configuration

The Spring Boot run configuration defines how to run your Spring Boot application in IntelliJ IDEA. The IDE creates a Spring Boot run configuration when you run the application from the main class file. For more information, see Run a Spring Boot application.

Create the Spring Boot run configuration

  1. From the main menu, select Run | Edit Configurations.

  2. In the Run/Debug Configurations dialog, click the Add button and select Spring Boot.

The Spring Boot run configuration

Name

Specify a name for the run configuration to quickly identify it among others when editing or running.

Run on

Select the target environment where you want to run the configuration. Besides running it locally, you can select to run your application on a remote machine via SSH or in a Docker container. For more information, see Run targets.

Store as project file

Save the run configuration settings to a file that you can share with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project.

By default, this option is disabled, and IntelliJ IDEA stores run configuration settings in .idea/workspace.xml.

Required options

The following options are mandatory to run your Spring Boot application:

JRE

Specify the Java runtime environment to use. In most cases, you should use the runtime that comes with the JDK configured for your project.

IntelliJ IDEA tries to detect and list the runtime environments that are available on your computer, including the one that is bundled with the IDE. You can also click Select alternative JRE… to manually specify the path to a runtime that the IDE failed to detect.

For more information, see SDKs.

Main class

Specify the fully qualified named of the class that will be passed to the Java runtime for execution. This class must contain the main() method, which will be used as the entrypoint for your application.

Modify options

Click Modify options to select additional options for running the configuration.

Modify options of a Spring Boot run configuration

Spring Boot

The following options are specific to running Spring Boot applications:

Active profiles

Specify which Spring profiles should be active.

This passes -Dspring.profiles.active on the command line, which overrides the spring.profiles.active property.

For more information, see Spring Boot: Profiles.

Enable debug output

Enable logging of the debug output.

This passes -Ddebug on the command line, which is similar to setting the debug property.

For more information, see Spring Boot: Logging.

Hide banner

Disable the start-up banner entirely.

This passes -Dspring.main.banner-mode=OFF on the command line, which is similar to setting the spring.main.banner-mode property to off.

For more information, see Spring Boot: Customizing the banner.

Disable launch optimization

Do not speed up the start-up time of your application.

By default, this optimization is enabled by passing the following JVM options on the command line: -XX:TieredStopAtLevel=1 and -noverify (the latter is deprecated in JDK 13 and later versions). This decreases the start-up time of the application at the expense of long-term performance and security. You can keep it enabled for development environments but disable it for production runs.

Disable JMX agent

Disable the JMX agent that shows the application endpoints data.

By default, the JMX agent is enabled by passing the following JVM options on the command line:

  • -Dcom.sun.management.jmxremote

  • -Dspring.jmx.enabled=true

  • -DSpring.liveBeansView.mbeanDomain

  • -Dspring.application.admin.enabled=true

This slows down the application startup. If you disable the JMX agent, the above options will not be added to the command line.

For more information, see Spring: JMX

On 'Update' action

Specify what to do when you modify the code and want to update the running application:

  • Do nothing: Do not update the application.

  • Update resources: Update all modified resource files.

  • Update classes and resources: Update all modified resource files and recompile all changed Java classes.

    When debugging, IntelliJ IDEA will deploy and reload updated classes. For more information, see Reload modified classes. Otherwise, when running the application regularly, IntelliJ IDEA will only update the changed classes in the output folder. Whether it will deploy and reload such classes in the running application depends on the capabilities of the Java runtime that you are using.

  • Update trigger file: Pass -Dspring.devtools.restart.trigger-file=.restartTriggerFile on the command line and update the .restartTriggerFile file, which will initiate a restart check: the application will restart only if there is something to do.

  • Hot swap classes and update trigger file if failed: This is similar to Update classes and resources followed by Update trigger file.

On frame deactivation:

Specify what to do when you switch from IntelliJ IDEA to another application (for example, a web browser):

  • Do nothing: Do not update the application.

  • Update resources: Update all modified resource files.

  • Update classes and resources: Update all modified resource files and recompile all changed Java classes.

    When debugging, IntelliJ IDEA will deploy and reload updated classes. For more information, see Reload modified classes. Otherwise, when running the application regularly, IntelliJ IDEA will only update the changed classes in the output folder. Whether it will deploy and reload such classes in the running application depends on the capabilities of the Java runtime that you are using.

Override configuration properties

Override any configuration property by passing it as a JVM option. For example, if you override the value of the spring.config.name property with my.config, IntelliJ IDEA will pass -Dspring.config.name=my.config on the command line when running this Spring Boot application.

Operating System

The following options are related to the operating system:

Allow multiple instances

Allow multiple instances of this run configuration to execute at the same time. By default, this option is disabled, which means that when you run the configuration, other active sessions of the configuration will terminate.

Working directory

Specify the directory that will be used for all relative input and output paths. By default, IntelliJ IDEA uses the project root as the working directory.

Environment variables

Specify the names and values of environment variables that are necessary when running this configuration.

Java

The following options are specific to the Java compiler and runtime for your Spring application:

Do not build before run

Do not compile the code before running it. This may be useful if you are only changing the resources, not the source code of your application.

Use classpath of module

Select the IntelliJ IDEA project module whose classpath to use when running the application.

For more information, see Module dependencies.

Add VM options

Specify additional JVM options for the java command that runs the application.

Separate options with spaces, enclose the values in double quotes if the value has spaces, escape quotes with backslashes, and pass environment variables if necessary.

Program arguments

Pass command-line arguments to your application.

Add dependencies with “provided” scope to classpath

Add the dependencies with the provided scope to the runtime classpath.

This option is enabled by default in Spring Boot run configurations.

Shorten command line

Select a method that will be used to shorten the command line if it exceeds the limitation of your OS.

  • none: Do not shorten the command line. If it exceeds the OS limitation, IntelliJ IDEA will prompt you to specify a shortening method.

  • JAR manifest: Pass the classpath via a temporary classpath.jar file. This temporary JAR file is specified in the Class-Path attribute of the manifest file.

  • @argfile (Java 9+): Pass the classpath via a temporary Java command-line argument file. This is available only for Java 9 and later versions.

Logs

The following options are related to logging the execution of your Spring Boot application. For more information, see View logs.

Specify logs to be shown in console

Specify which log files to display while running the application.

Click the Add button to add a new log. In the Edit Log Files Aliases dialog, configure the following:

  • Alias: The name of the tab where the log will be displayed.

  • Log File Location: Specify the path to the log file or an Ant pattern. If several files of a rolling log match the pattern, IntelliJ IDEA will display the most recent one.

  • Show all files coverable by pattern: Show all logs that match the pattern.

For logs in the table, you can configure the following options:

  • Is Active: Display the specified log file.

  • Skip Content: Do not display old log messages from previous runs.

Save console output to file

Specify a file to save the console output of your application.

Show console when a message is printed to stdout

Activate the console when the application writes to the standard output stream.

Show console when a message is printed to stderr

Activate the console when the application writes to the standard error stream.

Code Coverage

The following options are related to collecting code coverage statistics for your Spring Boot application. For more information, see Code coverage.

Specify classes and packages

Specify classes and packages to include in coverage data.

Exclude classes and packages

Specify classes and packages to exclude from coverage data.

Specify alternative coverage runner

Select a code coverage runner.

You can choose between the default IntelliJ IDEA coverage engine and JaCoCo.

Use tracing

Use the tracing mode to collect accurate branch coverage with the ability to track tests, view coverage statistics, and get additional information on each covered line.

By default, IntelliJ IDEA uses the sampling mode, which is faster but less accurate.

Collect coverage in test folders

Collect code coverage statistics for tests.

Before Launch

The following options configure what else to do when launching this run configuration.

Add before launch task

Specify other tasks to execute before launching this run configuration. For example, by default IntelliJ IDEA compiles the code before running the application. You can select to launch another run configuration, open some URL in a web browser, run an external tool, and so on. IntelliJ IDEA will execute the tasks in the order that you specify them.

Open run/debug tool window when started

Open the corresponding tool window when you start this run configuration:

  • View | Tool Windows | Run or Alt+4

  • View | Tool Windows | Debug or Alt+5

  • View | Tool Windows | Services or Alt+8

Show the run/debug configuration settings before start

Show the run configuration setting before starting it.

Last modified: 29 November 2022