Mohammad Daliri
Mohammad Daliri

Reputation: 1406

kotlin and spring boot error in Intellij

I'm creating a Kotlin project with Spring boot and Gradle project fromstart.spring.io

When importing this project to IntelliJ and run the project(Alt+Shift+F10) then show this error

Error: Could not find or load main class com.example.demo.DemoApplicationKt

mainclass :

package com.example.demo

import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication

@SpringBootApplication
class DemoApplication

fun main(args: Array<String>) {
    SpringApplication.run(DemoApplication::class.java, *args)
}

How can I solve this problem?

Upvotes: 1

Views: 1617

Answers (1)

Sangeet Suresh
Sangeet Suresh

Reputation: 2545

You can run the application by clicking the run button(play button) which is on the left side of the main class as shown in below picture.

enter image description here

If you run like this, it will automatically create run configuration

Upvotes: 2

Related Questions