- • Quickstart
- • Documentation
- • Documentation DevOps
- › Next Steps
- • Spring Boot
- • Spring Data
- • Spring Data MongoDB
- • Spring Security
- • Frontend
- • Multi-Module
Last updated: 2023-06-15
Working with your Spring Boot application in IntelliJ
Bootify aims to provide the best developer experience for starting new Spring Boot apps. Get your runnable application with custom database schema, frontend and REST API in no time - ready for import into IntelliJ.
Working with a Spring Boot application in IntelliJ is not difficult, as IntelliJ is designed for this scenario. However, there are a few things to consider that will make our life easier.
Import your sources
In order to add our newly created Spring Boot application to Intellij, we can use the import function to create the project. This function is available either in the initial popup or, if we already have an opened project in IntelliJ, under
File → New → Project from existing sources. A project in IntelliJ can include several applications (so-called modules). In case we want to add our source code to an existing project, we can do this with
File → New → Modules from existing sources.
Import project from existing sources
In the popup we select
build.gradle.kts (Kotlin) or
pom.xml (Maven) - IntelliJ will then automatically recognize everything else. If we have several
pom.xml in our project, we select the top one.
With a right click on the newly imported project and
Open Module Settings we can edit the project-specific settings. In case it's not already selected, we have to provide and select the JDK for Java 17, as this is the minimum requirement for Spring Boot 3.
Selecting the JDK for our project
Since Spring 6 the
-parameters flag is recommended for compiling Java source code, otherwise a warning will be logged. We can add this parameter under
Build, Execution, Deployment → Compiler → Java Compiler in the field
Additional command line parameters.
Warning about missing -parameters flag, replaced with an exception in future Spring versions
In the general settings under
File → Settings there is also an interesting preference for Gradle projects. Under
Build → Build Tools → Gradle the two settings "Build and run using" as well as "Run tests using" can be changed to IntelliJ. That will make the log output during testing and development more consistent.
Adjusting gradle preferences
Please also check out this article for the proper setup of Lombok in IntelliJ.
Now our Spring Boot application is ready to be launched. The build tasks are listed in the Gradle or Maven section in IntelliJ - we could start the application with
bootRun (Gradle) or
spring-boot:run (Maven). We could also start our application with our own RunConfiguration. For this purpose we create a new configuration of the type "Application" under
Run → Edit Configurations - the settings for our application are as follows.
Creating a run configuration for our Spring Boot microservice
In order to add our custom profile to the VM options, we have to activate it in the dropdown behind "Modify options" first. If we have a multi-module application, we select the hightest module ("web.main") at "Use classpath of module". In this way, we have all references modules ("base") included as well.
Now we can start our application from IntelliJ!
After configuring our database connection, our application is available at