
springboot
Terry20130701
这个作者很懒,什么都没留下…
展开
-
配置MVC
对于MVC,springboot有自己默认的配置,如果要改写默认配置,可以重写类WebMvcConfigurerAdapter中的方法。 下面的例子只是重写了两个方法,根据需要还可以重写很多其他的方法。 @Configuration public class MvcConfig extends WebMvcConfigurerAdapter { //运行跨域访问 @O原创 2017-06-05 14:40:05 · 336 阅读 · 0 评论 -
模板
springmvc中页面渲染通过ViewResolver,只要实现了ViewResolver接口的类在启动的时候都会被加载在ViewResolver列表中。 一个ViewResolver通常要指定它渲染的页面的prefix是什么,suffix是什么,比如freemarker的suffix必须为ftl,springboot默认 prefix为templates,这样只要是文件结尾(suffix)原创 2017-06-10 15:58:09 · 247 阅读 · 0 评论 -
springboot maven 打jar
在pom中加入 build> finalName>eureka-serverfinalName> plugins> plugin> groupId>org.springframework.bootgroupId> artifactId>spring-boot-maven-pluginartifactId>原创 2017-06-13 17:04:46 · 284 阅读 · 0 评论 -
redirect
以前springmvc的框架中要实现redirect即重定向的功能一般使用这个ViewResolver: InternalResourceViewResolver,所以在springboot中我们只需要注入此类即可。原创 2017-06-15 18:24:46 · 360 阅读 · 0 评论