springboot 碰到的问题
1.在springboot 启动报错
** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
该警告说明
ApplicationContext 不能从一个组件的默认包启动
解决办法
创建一个包,将启动文件放到这个包里。
如下:
package app; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class DemoApplication { public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
把启动文件放到app包下。
2.启动出错
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
出错原因:
程序中引入了mybatis ,但是代码中没有做任何配置。
所以需要在pom.xml 注释代码
<!--
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
-->
3.启动后访问不到控制器方法
原因:
启动程序没有和控制器在同一个目录。
启动程序放到app目录,控制器在 com目录下,这样控制器方法找不到。
解决办法
将启动程序放到com目录下,启动后问题解决。
springboot 碰到的问题的更多相关文章
- SpringBoot碰到的疑问或问题
1.@ResponseBody 和 @RequestBody 的区别 @ResponseBody是作用在方法上的,@ResponseBody 表示该方法的返回结果直接写入 HTTP response ...
- 解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE
问题 如下: 2017-07-16 08:50:57.436 INFO 13524 --- [ main] c.p.p.web.PointshopWebApplication ...
- 建立第一个SpringBoot小列子(碰到的错误)
当加入@SpringBootApplication注解时,无法得到解析 错误提示:SpringBootApplication cannot be resolved to a type 错误原因是因为s ...
- 解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE(转)
问题 如下: 2017-07-16 08:50:57.436 INFO 13524 --- [ main] c.p.p.web.PointshopWebApplication ...
- 使用spring-boot 国际化配置所碰到的乱码问题
写好html静态页面 , 也加上了编码格式 , 获取国际化展示在浏览器中还是存在乱码 , 开始以为是浏览器编码格式问题 , 做过处理后任没有得到解决 , 具体的处理方案如下: <meta ht ...
- SpringBoot整合mybatis碰到的问题
整合mybatis 1. 导包:在原有的web项目的基础上加上 <!--JDBC连接--> <dependency> <groupId>m ...
- springboot 使用c3p0数据库连接池的方法
使用springboot开发时,默认使用内置的tomcat数据库连接池,经常碰到这种情况:运行时间一长,数据库连接中断了.所以使用c3p0连接池吧. 引入的maven依赖: <dependenc ...
- springboot 开发入门,及问题汇总
1 . springboot简单介绍(http://projects.spring.io/spring-boot/) 现在的web项目几乎都会用到spring框架,而要使用spring难免需要配置大量 ...
- Jenkins远程部署SpringBoot应用
一般Web工程通过Jenkins远程部署到Tomcat,可以采用Maven的tomcat-maven-plugin插件进行部署.最近接触到Spring Boot工程的部署,由于Spring Boot应 ...
随机推荐
- 使用css方法使footer保持在页面的最底部
使footer保持在页面的底部,是常见的需求,之前面试的时候也遇见了一个这样的问题,今天在这里记录下css实现的方式. 使footer保持在页面的底部,需要考虑header+content部分不够多的 ...
- cookie与webStorage区别
- 通过docker-compose构建ghost博客(二)
上一篇通过yml文件构建 ghost博客,这次通过构建nginx服务,并添加反向代理来运行搭建的ghost博客. 目录结构 ghost.conf 就是 定义的nginx 加载的配置文件 server ...
- npoi设置数据有效性
npoi设置数据有效性 public void SetDataValidate(ISheet sheet, int firstCol, int lastCol) { CellRangeAddressL ...
- IDEA使用过程中常见小问题
在磁盘随便一个位置,创建一个文件夹,可以通过IDEA open 打开它 然后在将一些代码模块,放入这个文件夹,IDEA刷新,能够自动显示出来 然后执行下面的文档操作 1.IDEA通过一个项目文件导 ...
- Vue 全局注册逐渐 和 局部注册组件
//定义一个名为 button-counter 的新组件 Script: Vue.component('button-counter',{//button-counter 这个是组件的名字 data: ...
- Oracle_高级功能(5) 用户、角色、权限
一.用户(模式)1.定义用户:对数据库的访问,需要以适当用户身份通过验证,并具有相关权限来完成一系列动作模式(schema):是某个用户所拥有的对象的集合.具有创建对象权限并创建了对象的用户称为拥有某 ...
- C# 出现base-64 字符数组的无效长度的解决办法
最近的一个项目,在传递参数时,在Win2003上正常,在Win7下抛出“base-64 字符数组的无效长度”这样的错误 对比了一下经过Convert.ToBase64String()转换过的参数发现, ...
- hdu 1598 (并查集加贪心) 速度与激情
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1598 一道带有贪心思想的并查集 所以说像二分,贪心这类基础的要掌握的很扎实才行. 用结构体数组储存公 ...
- LED
LED 时间限制: 1 Sec 内存限制: 128 MB 题目描述 数字显示器题目描述:最近学校晚上文化广场的人很多哇,原因是晚上大屏幕会放电影.无聊的艾神和x73也决定一起去文化大广场看一场电影, ...