Skip to content
Advertisement

Name expected error when using @EnableAutoConfiguration in Spring Boot

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.

@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})

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

@SpringBootApplication(exclude = {MongoAutoConfiguration.class})

But this had the same error.

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement