我大概是想要笑死自己了
一开始疯狂百度
原因是springboot启动时会自动注入数据源和配置jpa
因此建议在Application启动类的注解上加上
exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}
但是我试过各种方法均无效
倒腾了几乎2小时时间
最后我迫于无奈一点一点的跟别人项目demo做对比
在添加pom依赖时候发现
我自己把数据访问层dao的依赖添加进去了导致他一直说我没有数据库配置信息
以下是部分报错信息以及截图
PS:第一次写程序博客,加油!
2020-03-18 15:49:03.316 INFO 16168 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-03-18 15:49:03.391 INFO 16168 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-03-18 15:49:03.717 WARN 16168 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2020-03-18 15:49:03.722 INFO 16168 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-03-18 15:49:03.754 INFO 16168 --- [ restartedMain] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2020-03-18 15:49:03.764 ERROR 16168 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).