Run spring boot with jdk9 using jigsaw modules

南楼画角 提交于 2019-11-29 07:12:44

I assume spring.boot is an automatic module. An automatic module doesn't declare it dependences so you have to use --add-modules to ensure that any explicit modules needed are resolved. If spring.boot were an explicit module then I assume it would requires java.sql and you won't have this issue.

finally, I got it... my module-info have to look like this:

module test {
    requires java.sql; // my real problem solved with this
    requires spring.boot.autoconfigure;
    requires spring.boot;
    exports com.foo.test; // subsequent error 1: beeing accessible for some spring modules
    opens com.foo.test to spring.core; // subsequent error 2: beeing accessible for spring.core in a deep reflection way
}

Can someone explain why I have to requires java.sql; inside my own module when I don't use it?

This is almost certainly because you are missing the jdbc driver jar for MySql. you need to use this dependency :-

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>6.0.5</version>
</dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!