I was able to launch a Spring Boot Kotlin App from IntelliJ 2017.3. After the last IntelliJ fix update I cannot start that application from the IDE, getting this exception:<
First of all, it's all due to class Kotlin class definition:
The
open
annotation on a class is the opposite of Java'sfinal
: it allows others to inherit from this class. By default, all classes in Kotlin are final
so if you are free to modify your source code, you can make your class not final, just adding open
to it's signature as follows:
@SpringBootApplication
open class DemoApplication
fun main(args: Array) {
SpringApplication.run(DemoApplication::class.java, *args)
}
or one of the possible solutions, according to this article:
The
@SpringBootApplication
is a convenience annotation that marks the class with the@Configuration
,@EnableAutoConfiguration
and@ComponentScan
annotations. It is the@Configuration
annotation that forces the use of the open keyword.
Is to try to remove the @SpringBootApplication
annotation and annotate your class with @EnableAutoConfiguration
and @ComponentScan
to solve this issue.