Skip to content
Advertisement

Spring Boot Application won’t start (IllegalStateException could not evaluate condition on DevToolsDataSourceAutoConfiguration)

I’ve tried to start my Spring Boot Application using IntelliJ. However, I cannot seem to make it work no matter whatever solutions I tried to implement to fix it. I believe it has something to do with spring.autoconfigure package, yet the root problem remains a mystery to me.

I am trying to take advantage of both Maven Multi Module System as well as Java Platform Module System. Below is my pom.xml, module-info.java files and project structure.

Project Structure

Simplified Project Structure

Note that there is a parent pom.xml file and each sub-module has its own pom.xml file. Each sub-module has its own module-info.java file as well.

Parent pom.xml

JavaScript

webapp pom.xml

JavaScript

webapp module-info.java

JavaScript

Below is what I tried: So when I run the application as it is I get the following exception

JavaScript

What I did to tackle this problem was changing webapp/module-info.java from

JavaScript

to

JavaScript

Aftwerwards, though, I got the following exception

JavaScript
  • I tried setting spring.devtools.restart.enabled=false. Same error followed.

  • I tried removing spring-boot-devtools from the list of dependencies. No error log yet start process exits with error code 0

  • I tried adding h2 database dependency just to see what happens. No good.

  • I tried changing spring-boot-devtools <scope> value and even commenting it out. No good.

  • I tried excluding DevToolsDataSourceAutoConfiguration.class from AutoConfiguration. No good.

  • I tried adding exports com.example; to module-info.java. No good.

  • If I run mvn test, mvn clean install, mvn spring-boot:run, I don’t get a single error and server is running just fine.

  • MainApplication.java resides at webapp/src/main/java/com/example/MainApplication.java.

JavaScript

Why is spring.autoconfigure trying to find a DataSource? Is IntelliJ‘s classpath messed up, and I need to update its dependencies manually? If I configure a proper database (such as mssql), would I still be facing this issue going forward?

What confuses me the most is that I get no error triggering the server to run by typing mvn spring-boot:run command. To be honest, this is what makes me think the problem has to do with IntelliJ's classpath settings rather than project structure and configuration.

Any help would be greatly appreciated. Thanks.

Advertisement

Answer

Editing module-info.java as the following resolved the problem for me

JavaScript
Advertisement