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.
Press Ctrl+Alt+S to open settings and then select
.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.

If a property is defined in multiple contexts, the inlay hint will show multiple definitions
Navigate to the property redefinition
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.
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:
A data source that is not yet set up in IntelliJ IDEA
Numerous databases such as in the case of microservices
An orchestration tool, such as Docker Compose

Run a Spring application in debug mode.
Open the Database tool window.
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.

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.
Alternatively, select the expression then press Ctrl+Alt+F8 or select Evaluate Expression from the floating toolbar that appears.
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
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.
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.

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.

Evaluate a Spring property
In the right-hand part of the expression field, select Spring Properties from the menu.
Enter the property that you want to evaluate and press Enter. The property value and details appear under the result node.
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.
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.
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.
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
Suspend your application at a line that executes within a transaction.
Open the Debug tool window and switch to the Variables tab. The transaction details are displayed under the transaction node.
When in a transaction, you can also navigate to the place in the code where it was initiated.
Navigate to the transaction source
In the Variables tab, click Navigate to source
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:

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:

The icon colors indicate the following statuses:
green – loaded
transparent – not loaded
yellow – mocked
Additionally, a bean can have one of the following icons:
: 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 theorg.springframework.data.repository.Repository
interface).: controllers (classes annotated with
@Controller
and@RestController
).: implicit beans—that is, service beans added by Spring that are not defined explicitly.
: abstract XML beans (defined with the
abstract="true"
attribute in XML files).: 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
.: beans with the prototype scope (defined with the
scope="prototype"
in XML files).: 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.