我的开发工具是IntelliJ IDEA,然后在SpringBoot集成Mybatis,前端用模块引擎Thymeleaf的过程中遇到几个问题,不过也花了点时间,现在记录下来,作为笔记记录。

Invalid bound statement异常

开发中经常遇到,下面给出我的两种方法

Invalid bound statement (not found):

①Mapepr.xml文件中文nameapce没有和mapper接口发生映射

②有可能是在IDEA编辑器运行的项目,需要project structure设置mybatis的xml文件夹为resource

Thymeleaf前端显示时间格式不规范

解决方案是写个配置类

package com.muses.taoshop.manager.config;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale; /**
* <pre>
* Thymeleaf模板引擎配置
* </pre>
*
* @author nicky
* @version 1.00.00
* <pre>
* 修改记录
* 修改后版本: 修改人: 修改日期: 2018.09.22 10:50 修改内容:
* </pre>
*/
@Configuration
public class ThymeleafConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware{ @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { } @Override
public void addFormatters(final FormatterRegistry registry){
super.addFormatters(registry);
registry.addFormatter(dateFormatter());
} @Bean
public DateFormatter dateFormatter(){
return new MyDateFormatter();
} class MyDateFormatter extends DateFormatter {
@Override
public String print(Date date, Locale locale) {
//return super.print(date, locale);
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
}
}
}

获取后台timestamp类型数据,页面得到一串unix long类型数据

获取后台timestamp类型数据,页面得到一串unix long类型数据,解决方案是用fastjson的@JSONField注解可以解决

 @JSONField(format ="yyyy-MM-dd HH:mm:ss")
private Date createTime;

最新文章

  1. .Net4.0以上使用System.Data.Sqlite
  2. CentOS7 SWAP 设置 (实测 笔记)
  3. HTTPS的一些疑问解答
  4. 【ORACLE】记录通过执行Oracle的执行计划查询SQL脚本中的效率问题
  5. 纯手写分页控件CSS+JS+SQL
  6. 团队博客——Sprint计划会议1
  7. 实战Django:官方实例Part4
  8. Zabbix Api的使用
  9. [改善Java代码]注意Class类的特殊性
  10. adb server is out of date. killing... 解决方案
  11. highcharts的使用
  12. pymssql文档
  13. ErrorKiller:Failed to decode response: zlib_decode(): data error
  14. 【基础】这15种CSS居中的方式,你都用过哪几种?
  15. SVN忽略不提交文件夹
  16. Docker Swarm 创建服务
  17. dotnet 命令
  18. 白鹭引擎 - 文本类型 ( TextField, )
  19. html select 和dropdownlist小结收集
  20. Centos下添加PHP对MSSQL的支持

热门文章

  1. node.js 使用NAPI写C++插件,(部分转帖)
  2. Android自动化之Monkey环境搭建(一)
  3. JS 变量提升与函数提升
  4. mysql锁机制(Innodb引擎)
  5. Unity - Photon PUN 本地与网络同步的逻辑分离 (一)
  6. C#数据同步中基本步骤和用到的相关函数
  7. 异步async与await的简单探究
  8. # 2019-2020-4 《Java 程序设计》结对项目总结
  9. vue中created、mounted、 computed,watch,method 等方法整理
  10. (转)RandomAccessFile类使用详解