为了账号安全,请及时绑定邮箱和手机立即绑定

一直报debug错误


Hello World!

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.1.RELEASE)

2019-11-27 14:53:14.419  INFO 21648 --- [           main] com.miaoshaproject.App                   : Starting App on LAPTOP-SDCT0OIQ with PID 21648 (started by 28385 in E:\新建文件夹\miaosha)
2019-11-27 14:53:14.424  INFO 21648 --- [           main] com.miaoshaproject.App                   : No active profile set, falling back to default profiles: default
2019-11-27 14:53:16.826  INFO 21648 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-27 14:53:16.835  INFO 21648 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-27 14:53:16.835  INFO 21648 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-27 14:53:16.926  INFO 21648 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-27 14:53:16.926  INFO 21648 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2399 ms
2019-11-27 14:53:17.016  WARN 21648 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'app': Unsatisfied dependency expressed through field 'userDOMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDOMapper' defined in file [E:\新建文件夹\miaosha\target\classes\com\miaoshaproject\dao\UserDOMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine suitable jdbc url
2019-11-27 14:53:17.019  INFO 21648 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-11-27 14:53:17.112  INFO 21648 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-27 14:53:17.115 ERROR 21648 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine suitable jdbc url


Action:

Consider the following:
 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
 If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1


正在回答

2 回答

1.application.properties中指定 datasource.url


spring.datasource.name=miaosha
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/miaosha
spring.datasource.username=lizhch
spring.datasource.password=lizhch

2.pom中引入 mysql的驱动

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.41</version>
</dependency>


1 回复 有任何疑惑可以回复我~

application.properties中指定 datasource.url


spring.datasource.name=miaosha

spring.datasource.username=root
spring.datasource.password=root


1 回复 有任何疑惑可以回复我~
#1

慕斯卡7159990 提问者

我就是这么写的,还是报debug错误,
2019-11-27 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
SpringBoot构建电商基础秒杀项目
  • 参与学习       49064    人
  • 解答问题       954    个

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

进入课程

一直报debug错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信