Features Tips & Tricks

Spring Kotlin Gutters and Navigation

Let’s continue our posts on how IntelliJ IDEA supports developing Spring Framework applications with Kotlin. For now, let’s talk about navigation. The common way of navigation within a Spring Configuration is using gutters, and all Spring-related gutters are now available in Kotlin.

Let’s try with @ComponentScan-based configuration (if you are not in Spring Boot you’ll probably need to configure application context):

ComponentScanConfig

Then let’s add a dependency from one bean to another, there is even an action for that: Code → Generate → Autowired Dependency

AddAutowiredDependency

If you have more than one bean of a certain type then IntelliJ IDEA will help you with managing qualifiers:

MultipleAutowiredCandidates

Qualifiers will be renamed when the bean name is changed, and a bean name can also be changed from the qualifier reference:

So this is how navigation works between Spring Beans written in Kotlin, and of course, it will work the same way in mixed projects.

More posts on Kotlin with Spring support in IntelliJ IDEA are going to come. Please stay tuned and check out other features for Spring in IntelliJ IDEA!

image description