Spring and Kotlin final classes
It’s time for the next topic in the series of blogs on using Spring Framework with Kotlin support in IntelliJ IDEA.
Kotlin classes are final by default, but some Spring functionality requires classes to be open. For instance, `@Configuration` classes should be extendable, and methods annotated with `@Transactional` or `@Async` must also be extendable. If you don’t want to bother with it, there is the all-open plugin as well as the spring plugin for Kotlin compiler. But if you don’t like the idea of modifying Kotlin rules by compiler plugins and don’t mind an additional `open` modifier on your classes and methods, then IntelliJ IDEA offers an inspection that checks that all necessary classes and members are declared open:
Ordinary beans in Spring don’t have to be `open`, unless they have methods with specific annotations, like `@Caching` or `@Transactional`:
So if you don’t use Kotlin compiler plugins, IntelliJ IDEA will still check the openness of your classes and members to avoid problems at runtime.
More posts about Kotlin with Spring support in IntelliJ IDEA are to come. Please stay tuned!
Subscribe to Blog updates
Thanks, we've got you!
Import Postman Collections to the HTTP Client
We know that many of you use Postman collections and want to stay in the flow while working with them. This means staying inside IntelliJ IDEA and not switching to a different app. Great news! You can now effortlessly transform Postman collections into .http and use them in the HTTP Client …
Profile on the Fly With the IntelliJ Profiler
At JetBrains, we believe that profiling should be simple and accessible to all developers, regardless of their level of expertise. That’s why the IntelliJ Profiler puts ease of use and seamless integration at the forefront of its mission. In previous releases, we introduced a range of features to s…
History of Gradle Delegation Process in IntelliJ IDEA
Nowadays, a build tool is an essential part of any project, and IntelliJ IDEA integrates with the majority of them. Among the most popular build tools is Gradle. We’d like to give a brief historical overview of its integration with IntelliJ IDEA and the delegation process implemented inside the I…
How to Work With Protobuf-Maven Projects in IntelliJ IDEA
Protobuf, short for Protocol Buffers, is a language-agnostic data serialization format developed by Google. It is designed to efficiently and reliably serialize structured data to communicate between different systems and programming languages. Protobuf offers a compact binary representation of data…