Name expected error when using @EnableAutoConfiguration in Spring Boot

Tags: , , , ,

I was having a similar error to the one found here and also here. I attempted to use @EnableAutoConfiguration to fix the error as was suggested, but IntelliJ gives me an error and says “Name expected”. I am unsure what exactly is causing this problem. One possible difference is that I am working in Kotlin and not in Java. Here is the line that is returning the error.


I also attempted to use the second question’s solution of:

@SpringBootApplication(exclude = {MongoAutoConfiguration.class})

But this had the same error.


Your guess about Kotlin is right. You’re trying to use Java syntax in Kotlin. In Kotlin the first annotation will look like this:

@EnableAutoConfiguration(exclude = [MongoAutoConfiguration::class])

Check Kotlin documentation about annotations for more details if necessary.

Source: stackoverflow