Java 定义为;jdbc.properties“;对于mybatis,但仍需要在application.properties中添加spring.datasource?
我不熟悉春靴和mybatis。我用spring initilizer生成了我的spring boot mybatis项目。 这是我的配置: 应用程序属性 mybatis config.xml 我认为这已经足够了,但是当我运行应用程序时,它会显示错误Java 定义为;jdbc.properties“;对于mybatis,但仍需要在application.properties中添加spring.datasource?,java,database,spring-boot,mybatis,Java,Database,Spring Boot,Mybatis,我不熟悉春靴和mybatis。我用spring initilizer生成了我的spring boot mybatis项目。 这是我的配置: 应用程序属性 mybatis config.xml 我认为这已经足够了,但是当我运行应用程序时,它会显示错误 SsmApplicationTests > contextLoads() FAILED java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.
SsmApplicationTests > contextLoads() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException at ConstructorResolver.java:798
Caused by: org.springframework.beans.factory.BeanCreationException at ConstructorResolver.java:656
Caused by: org.springframework.beans.BeanInstantiationException at SimpleInstantiationStrategy.java:185
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException at DataSourceProperties.java:235
但是当我将配置添加到application.properties时。它很好用
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
我真的很困惑,有人知道为什么吗?应该排除DataSourceAutoConfiguration.class,如下所示:
jdbc.driverClass=oracle.jdbc.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:test
jdbc.username=root
jdbc.password=root
SsmApplicationTests > contextLoads() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException at ConstructorResolver.java:798
Caused by: org.springframework.beans.factory.BeanCreationException at ConstructorResolver.java:656
Caused by: org.springframework.beans.BeanInstantiationException at SimpleInstantiationStrategy.java:185
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException at DataSourceProperties.java:235
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver