每天一点点(StringBoot 我的第一次)

框架环境:

编译工具:idea 

java jdk(1.8)

maven 3.3.9 

以上点环境需求自己下载安装即可(百度一坨)

 

 

 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-03-04 22:19:44.362 ERROR 5956 --- [           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 a suitable driver class


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).

Disconnected from the target VM, address: '127.0.0.1:59455', transport: 'socket'

Process finished with exit code 1

 

下面的才是关键 : 我们有数据源却没有配置( 我们在创建项目的时候 现在了mybatis  + mysql 所以才有这个提示 :先不着急配置 然后注掉 pom文件中的mybatis和 mysql ) 

 

先定一个小目标 用springboot完成一个helloworld 之后再下一步学习(所以先注释掉pom文件中的数据源) 注释掉后以下点问题得以解决

成功启动了

然后开心访问:

原因1:(我的问题就是目录结构不对, 于是修改一番)

Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 
原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.

原因2:

在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题: 
当pom文件下的spring-boot-starter-paren版本高时使用: 
spring.mvc.view.prefix/spring.mvc.view.suffix 
当pom文件下的spring-boot-starter-paren版本低时使用: 
spring.view.prefix/spring.view.suffix

原因3: 

requestMapping 写的和访问路径不一致

再次启动: 请求成功

             

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值