IntelliJ IDEA 2025.1 Help

Spring debugger

IntelliJ IDEA helps you handle many Spring-specific issues at design-time. However, some of them might require a runtime investigation. For this case, IntelliJ IDEA's debugger recognizes Spring context and provides you with tools to inspect and interact with Spring applications running in debug mode.

Install the Spring Debugger plugin

This functionality relies on the Spring Debugger plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the Spring Debugger plugin, and click Install (restart the IDE if prompted).

Spring debugger is supported for the following run configuration types:

Review the current configuration

Properties defined in a .properties are often overridden at runtime, either by another .properties file or a bean. If the actual value at runtime is different from the one specified in a .properties file, the corresponding line gets an inlay hint revealing the actual configuration value.

The overridden property values are displayed in the application.properties file

If a property is defined in multiple contexts, the inlay hint will show multiple definitions

  • To see which piece of code overrides the property value, click the inlay hint that shows the actual value. The overriding code opens in the editor.

    The inlay hint shows the actual value of a property

Database connections

When you are running your Spring application in debug mode, IntelliJ IDEA displays the current database connections in the Database tool window.

Among other scenarios, this might be useful when you are working with:

The Database tool window shows a database running on a random port
  1. Run a Spring application in debug mode.

  2. Open the Database tool window.

  3. Click the Refresh button.

In the discovered databases, you can view the tables, directly execute SQL queries, explore the schema, and so on, similar to how you would with any other data source.

The contents of a database table in an editor tab

Spring context in debugger expressions

When evaluating an expression in IntelliJ IDEA's debugger, you have access to all properties and beans, regardless of whether they are present in the current execution context. This lets you execute methods of any bean to retrieve data and test hypotheses.

Evaluate an expression from the editor / add a watch

  • Hold Alt and click the expression you want to evaluate.

    A popup showing detailed information about a bean
  • Alternatively, select the expression then press Ctrl+Alt+F8 or select Evaluate Expression from the floating toolbar that appears.

    Floating toolbar with the Evaluate Expression button

    You can add the expression to watches by clicking in the toolbar.

Evaluate an arbitrary expression / add a watch

  • To evaluate an arbitrary expression, enter it in the Evaluate expression field in the Variables tab and press Enter

    An expression in the Variables tab

    The result is displayed right below. You can also add the expression to watches by clicking in the right-hand part of the expression field.

    The result of the expression in the Variables tab

For convenience, you might want to view collections in a separate dialog by clicking Explore elements near the result row. This view paginates the results and lets you search and filter them.

The 'Collection Presentation' dialog shows the contents of a large collection

If the result of the expression is a JSON- or XML-formatted string, you can view it as a structured document. This lets you use editor features like code folding and extend or shrink selection for working with subtrees and convenient navigation in big objects.

%alt

Evaluate a Spring property

  1. In the right-hand part of the expression field, select Spring Properties from the menu.

  2. Enter the property that you want to evaluate and press Enter. The property value and details appear under the result node.

    Property value and details in the Variables tab

    If you want to set up a watch for this property, click in the right-hand part of the expression field.

Expressions in breakpoints

Similar to expressions and watches, you can use expressions in breakpoints. This lets you add temporary logging and suspend the application only when a condition is met.

Set conditional breakpoints

  • Right-click a breakpoint and enter the condition in the Condition field.

    'Line breakpoint' popup with an expression in the 'Condition' field

    The breakpoint will only suspend the application when the condition evaluates to true.

Set logging breakpoints

  • Right-click a breakpoint, click More, and enter the logging expression in the Evaluate and log field.

    'Breakpoints' dialog with an expression in the 'Evaluate and log' field

    The breakpoint will log the expression result to the console in addition to suspending the application. If you want to only log the expression without suspending the application, clear the Suspend checkbox.

    'Line breakpoint' popup with an expression in the 'Evaluate and log' field and cleared 'Suspend' checkbox

For information on breakpoint types and filters refer to the Breakpoints page.

Debug transactions

If the operation you are currently debugging takes place inside a JPA transaction, you can view the session context, including the transaction's isolation level, propagation status, and cache contents, directly in the debugger.

View transaction details

  1. Suspend your application at a line that executes within a transaction.

    The app suspended at a line in a method marked as @Transactional
  2. Open the Debug tool window and switch to the Variables tab. The transaction details are displayed under the transaction node.

    The transaction details in the Variables tab

When in a transaction, you can also navigate to the place in the code where it was initiated.

  • In the Variables tab, click Navigate to source

    'Navigate to source' button in the Threads & Variables tab

For JPA entities that are included in the transaction, you can review their current state in the Debug tool window's Variables tab and near the entity mentions in the code:

Entity state is displayed in the editor near the entity usages

Review loaded beans

When running a Spring application in debug mode, the Project tool window indicates the runtime status of each bean from the Spring point of view:

Bean classes have different icons in the Project tool window

The icon colors indicate the following statuses:

  • green – loaded

  • transparent – not loaded

  • yellow – mocked

Additionally, a bean can have one of the following icons:

  • Spring Java bean: auto-discoverable beans declared with @Component annotations as well as methods annotated with @Bean.

  • : configuration beans (annotated with @Configuration or other annotations that implicitly include @Configuration).

  • : repository beans (annotated with @Repository or extending the org.springframework.data.repository.Repository interface).

  • : controllers (classes annotated with @Controller and @RestController).

  • Spring bean: implicit beans—that is, service beans added by Spring that are not defined explicitly.

  • Spring abstract beans: abstract XML beans (defined with the abstract="true" attribute in XML files).

  • Spring abstract beans: infrastructure beans—that is, beans defined in XML files related to the configuration and general infrastructure support, such as ViewResolver or beans with context:component-scan.

  • Spring prototype beans: beans with the prototype scope (defined with the scope="prototype" in XML files).

  • Spring bean: other beans defined in XML files.

Disable Spring Debugger

You can disable Spring Debugger features for a specific run/debug configuration.

  • In the settings of a run/debug configuration, click Modify Options, then select Disable Spring Debugger.

    'Modify Options' button in run configuration settings
Last modified: 02 June 2025