最近接手一个项目,使用的框架是springboot+mybatis: 其中持久层是使用mybatis集成的,sql是配置在mapper.xml文件中: 然后呢,有时候做新功能的时候,往xml文件中增加新的sql逻辑的时候,总会因为疏忽,或者手误 等原因,造成一些错误 具体表现就是:eclipse的控制台一直在快速的刷日志,也没有看到什么报错的东西,就是刷一些加载class文件的内容: 百度之后说是xml配置文件错的,还有一些文章是说要去 源码中的某个抛错的地方增加断点,可是每次加了断点之后 启动…
早期业务紧急,没有过多的在意项目的运行效率,现在回过头看走查代码,发现后端项目(Spring MVC+MyBatis)在启动过程中多次解析mybatis的xml配置文件及初始化数据,对开发阶段开发人员反复启停项目造成很大的时间浪费,也即是下面的第一种方式. 1.Servlet方式 @Component public class InitDataServlet extends HttpServlet {    private static final Logger LOGGER = Logger.…
常有在spring容器启动后执行某些操作的需求,现做了一个demo的实现,做一下记录,也希望可以给需要的同学提供参考. 1.spring启动后,以新线程执行后续需要的操作,所以执行类实现Runnable接口 @Component public class StepExecutor implements Runnable{ @Overridepublic void run() {startStreamTask(); } public void startStreamTask() { //do yo…
Springboot给我们提供了两种“开机启动”某些方法的方式:ApplicationRunner和CommandLineRunner. 这两种方法提供的目的是为了满足,在项目启动的时候立刻执行某些方法.我们可以通过实现ApplicationRunner和CommandLineRunner,来实现,他们都是在SpringApplication 执行之后开始执行的. CommandLineRunner接口可以用来接收字符串数组的命令行参数,ApplicationRunner 是使用Applicat…
Springboot给我们提供了两种"开机启动"某些方法的方式:ApplicationRunner和CommandLineRunner. 这两种方法提供的目的是为了满足,在项目启动的时候立刻执行某些方法.我们可以通过实现ApplicationRunner和CommandLineRunner,来实现,他们都是在SpringApplication 执行之后开始执行的. CommandLineRunner接口可以用来接收字符串数组的命令行参数,ApplicationRunner 是使用App…
解决参考文章:https://blog.csdn.net/hengyunabc/article/details/78762097 spring boot启动报错如下: Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. -- :: --- [ main] o.s.b.d.LoggingFailureAnal…
出现问题的原因 server.servlet.context-path=testDemospring.mvc.static-path-pattern=/static/**定义项目名和静态资源路径后发现,templates中html 中引用的css,js的相对路径出现异常在上面目录中,index.html 通过相对路径引用css href="../static/xxx" 就获取不到了在没有定义 server.servlet.context-path=testDemo 的前href=&qu…
原因为:SpringBoot内置Tomcat没有正常启动,在pom.xml 中添加: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope></dependency> 重新运行项目便可启动嵌入的tomca…
0.前言 在开发中,我们经常需要以不同端口启动同一个项目的多个实例,IDEA中启动多个实例很简单 1.方法 1.1.在项目中,选择编辑配置,然后点选允许并行运行,如下图: 1.2.调出RunDashboard面板方便我们查看,调出方法: 在项目的.idea文件夹下找到workspace.xml文件, 打开,找到RunDashboard节点,添加如下选项,如下 <option name="configurationTypes"> <set> <option…
我的spring boot + mybatis项目在idea里面执行正常,但发布测试环境打成可执行jar包后就启动失败,提示错误如下: [ ERROR] [2018-08-30 17:23:48] org.springframework.boot.SpringApplication [845] - Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creat…