spring boot thymeleaf 热部署

在使用spring boot 开发的时候,使用了Thymeleaf 作为前端的模板开发,发现在调试过程中,改动了Thymeleaf模板后,需要重新启动下项目,才可以立即生效
解决办法:
ctrl+shift+f9

http://www.oschina.net/question/779083_2148086

spring boot推荐支持,因为spring boot是快速开发,而thymeleaf又是原型即页面,所以从理念是接近的

单纯从效率上看,没有什么优势,而且用这种测试也不太准
thymeleaf 的首次渲染比Beetl差的是数量级,后续的持续渲染,3.0版本是有很大提升的,也和Beetl也差不多
优势是 html 的显示优势 前后端可以很好的分离,要是有很多的页面拆分(include 的部分)优势也不是很明显了

是的,基本上都会抽出一些公用模版,所以这种优势并不明显,像引入的js,css

如果配置了HttpMessageConverter,然后在@ResponseBody的接口的返回值使用JSON.toJSONString()转换过,输出的结果就会有以下提示

解决办法:接口直接返回对象,Spring会调用已经配置的HttpMessageConverter将对象转换成json字符串

另外一个解决地思路:http://blog.csdn.net/u010161082/article/details/46618947

HttpMessageConvert配置示例:

    <bean id="fastJsonHttpMessageConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
<property name="fastJsonConfig">
<bean class="com.alibaba.fastjson.support.config.FastJsonConfig">
<property name="features">
<list>
<value>AllowArbitraryCommas</value>
<value>AllowUnQuotedFieldNames</value>
<value>DisableCircularReferenceDetect</value>
</list>
</property>
<property name="dateFormat" value="yyyy-MM-dd HH:mm:ss"></property>
</bean>
</property>
</bean>

http://blog.csdn.net/my_god_sky/article/details/53385246

<?xml version="1.0" encoding="UTF-8"?>
<!-- 注意!SpringMVC的配置文件使用的是mvc命名空间 -->
<beans:beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> <context:annotation-config/>
<context:component-scan base-package="com.mkyong.common.controller" /> <annotation-driven>
<message-converters register-defaults="true">
<!-- @ResponseBody乱码问题,将StringHttpMessageConverter的默认编码设为UTF-8 -->
<beans:bean class="org.springframework.http.converter.StringHttpMessageConverter">
<beans:constructor-arg value="UTF-8"/>
</beans:bean>
<!-- 配置Fastjson支持 -->
<beans:bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<beans:property name="charset" value="UTF-8"/>
<beans:property name="supportedMediaTypes">
<beans:list>
<beans:value>application/json</beans:value>
<beans:value>text/html;charset=UTF-8</beans:value>
</beans:list>
</beans:property>
<beans:property name="features">
<beans:list>
<beans:value>WriteMapNullValue</beans:value>
<beans:value>QuoteFieldNames</beans:value>
<beans:value>WriteDateUseDateFormat</beans:value>
<beans:value>WriteEnumUsingToString</beans:value>
</beans:list>
</beans:property>
</beans:bean>
</message-converters>
</annotation-driven>
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/"/>
<beans:property name="suffix" value=".jsp"/>
</beans:bean>
</beans:beans>

http://www.cnblogs.com/sunp823/p/5601397.html

Rest接口和Thymeleaf的两个坑的更多相关文章

  1. 两个坑-Linux下Network-Manager有线未托管-DNS resolv.conf文件开机被清空

    Linux里面有两套管理网络连接的方案: 1./etc/network/interfaces(/etc/init.d/networking) 2.Network-Manager 两套方案是冲突的,不能 ...

  2. iscroll遇到的两个坑

    最近移动端闪付遇到的两个坑做下总结: 1.使用iscroll后,滑动并没有生效 解决方案: 首先要查看:结构是否正确: <div id="wrapper">   //w ...

  3. 记自己在spring中使用redis遇到的两个坑

    本人在spring中使用redis作为缓存时,遇到两个坑,现在记录如下,算是作为自己的备忘吧,文笔不好,望大家见谅: 一.配置文件 <!-- 加载Properties文件 --> < ...

  4. MySql 5.7安装(随机密码,修改默认密码)两个坑

    MySql 5.7安装(随机密码,修改默认密 下载了MySql 最新版本,安装的过程中,发现了很多新特性 1.data目录不见了 在进行my-default.ini配置的时候 (需要配置 # base ...

  5. Java 基础 面向对象: 接口(interface )概念 以及接口之练习3 -定义一个接口用来实现两个对象的比较并 判断instanceof是否为同类

    接口(interface )概念概念笔记 及测试代码: /** 面向对象: 接口(interface ) 是与类并行的一个概念: * 1.接口可以看成一个特殊的抽象类,它是常量与抽象方法的一个集合 * ...

  6. jQueryUI Draggable 和 Droppable 配合使用时遇到的两个坑

    jQueryUI 的 拖拽插件极大的方便了开发者对拖拽功能的实现,但是官方教程给的太笼统,在具体实现的时候很多地方不明确,这里说一下我遇到的两个 "小坑": 1:Draggable ...

  7. redis主从遇到的两个坑

    最近在使用redis主从的时候做了下面两件事情: 1 希望redis主从从操作上分析,所有写操作都在master上写,所有读操作都在从上读. 2 由于redis的从是放在本地的,所以有的key的读写操 ...

  8. 微信JS-SDK 接口调用与 php 遇到的坑

    问题:config:invalid signature一直爆这个错误 解决: 看我把这些坑都总结了一下:要命的invalid signature. https://segmentfault.com/q ...

  9. 微信js-sdk接口的使用及ios深坑

    最近再做微信公众号开发,涉及到手机上传图片和拍照的功能. 思路一:使用<input type="file" name="pic" id="pic ...

随机推荐

  1. Android进阶(十七)AndroidAPP开发问题汇总(一)

    首先来看一下猎头公司对于Android方向人才招聘的需求: 猎头公司推荐------资深Java软件工程师(Android方向) 岗位职责: 1.熟悉Java语言,熟悉B/S开发的基本结构 2.能运用 ...

  2. JAVA中重写equals()方法的同时要重写hashcode()方法

    object对象中的 public boolean equals(Object obj),对于任何非空引用值 x 和 y,当且仅当 x 和 y 引用同一个对象时,此方法才返回 true:注意:当此方法 ...

  3. 软件工程师 Book

    一.软件工程师  --Clean Code<代码整洁之道>  --Implementation Patterns<实现模式>  --Code Complete<代码大全& ...

  4. python实现博客自动刷点击脚本

    #A Auto-Visit Web Site Tool import urllib import time import random print "Auto Click the WebPa ...

  5. SpringBoot2.0之二 新建RESTfull风格项目

    1.新建一个Maven项目(具体方法可以参照 SpringBoot之一) 2.先建一个User类 package com.somta.springboot.pojo; public class Use ...

  6. Python的lambda

    if else 可以用简单的三元运算符表示 if 1 == 1: name = 'wupeiqi' else: name = 'alex' --> name = 'wupeiqi' if 1 = ...

  7. 常见Map 及 ArrayList 是否有序总结

      常见Map 及 ArrayList 是否有序总结 说明:此处的排序 是指: 1: 往集合中插入元素的顺序与遍历元素的顺序的关系: 2: 往对象中插入元素否会根据元素的大小排序 public cla ...

  8. 二分查找算法的C++和PHP实现

    C++实现方式: #include<iostream> #include<stdlib.h>#include<algorithm> using namespace ...

  9. laravel项目使用twemproxy部署redis集群

    twemproxy是twitter开发的一个redis代理proxy,Twemproxy可以把多台redis server当作一台使用,开发人员通过twemproxy访问这些redis servers ...

  10. [译文]Domain Driven Design Reference(二)—— 让模型起作用

    本书是Eric Evans对他自己写的<领域驱动设计-软件核心复杂性应对之道>的一本字典式的参考书,可用于快速查找<领域驱动设计>中的诸多概念及其简明解释. 其它本系列其它文章 ...