codecamp

Spring MVC 默认配置的定制化

在MVC Java编程配置方式下,如果你想对默认配置进行定制,你可以自己实现WebMvcConfigurer接口,要么继承WebMvcConfigurerAdapter类并覆写你需要定制的方法:

@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {

    // Override configuration methods...

}

在MVC XML命名空间下,如果你想对默认配置进行定制,请查看<mvc:annotation-driven/>元素支持的属性和子元素。你可以查看Spring MVC XML schema,或使用IDE的自动补全功能来查看有哪些属性和子元素是可以配置的。


Spring MVC 启用MVC Java编程配置或MVC命名空间
Spring MVC 转换与格式化
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }