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应 ...
随机推荐
- 微信小程序接入百度统计
一. 百度统计添加应用,获取appkey和微信小程序统计sdk: 1. 百度统计首页,点击“我的全部应用”右侧的添加按钮: 2. “应用类型”选择小程序统计,选择微信小程序,填写应用名称信息,选择内容 ...
- CodeForces - 873B Balanced Substring(思维)
inputstandard input outputstandard output You are given a string s consisting only of characters 0 a ...
- python3之subprocess常见方法使用
一.常见subprocess方法 1.subprocess.getstatusoutput(cmd) 官方解释: Return (exitcode, output) of executing cmd ...
- Kafka基本使用
Kafka基本使用 官网地址 http://kafka.apache.org/ 一切应以官网文档为准. 安装 download里下载要安装的版本.或者直接wget该网址.如wget http:/ ...
- Vue 安装脚手架 工具 vue-cli (最新)
假如您安装过旧版脚手架工具(vue-cli),您可以通过 npm uninstall vue-cli -g 或 yarn global remove vue-cli卸载. Vue CLI 需要Node ...
- GM Tech 2 works with Hummer Yes or No
This is about GM Tech 2 scan tool for Hummer troubleshooting and programming. Can I have a cheap Tec ...
- PS故障风海报制作技术分享
1.首先找一张看起来很酷的图(也可以选择自己喜欢的图片): 2. 复制图层,点击添加图层样式,选择混合选项,在高级混合里面的通道选项,有R.G.B三个通道选项,默认是全部勾选的状态,选择其中一个勾掉( ...
- \\Device\\PhysicalMemory
从Windows Server 2003 with SP1 以后就禁用了用户态访问\\Device\\PhysicalMemory,要访读取SMBIOS的信息,请使用以下API:•EnumSystem ...
- jmeter对需要登录的接口进行性能测测试
只需要一步: https://www.testwo.com/blog/7253
- python flask 项目结构
1. 今天学习遇到一个问题,以前项目比较简单,所有的@app.route 都是写在一个文件app.py 中的,然后启动也是在这个文件中启动app.run .但是我今天 想写一个新的模块, 于是我新启了 ...