美文网首页
Spring Boot MVC

Spring Boot MVC

作者: 风雨楼兰 | 来源:发表于2018-10-23 23:55 被阅读0次

    yml配置模板:

     thymeleaf:
        cache: false
        prefix: classpath:/templates/
        suffix: .html
        encoding: UTF-8
        mode: HTML
        servlet:
          content-type: text/html
    

    自动配置扩展

    @Configuration
    //@EnableWebMvc 覆盖默认配置加此标签
    public class CustomWebMvcConfigurer implements WebMvcConfigurer{
    
    }
    

    静态资源默认路径:static public resources

    欢迎界面:resources/static/index.html

    webjars jquery:
    grade引入

        compile group: 'org.webjars', name: 'webjars-locator-core', version: '0.35'
        compile group: 'org.webjars', name: 'jquery', version: '3.3.1-1'
    

    html引入:

    <script type="application/javascript" src="/webjars/jquery/3.3.1-1/jquery.min.js"></script>
    

    view Controller:

    @Controller
    @RequestMapping("/user/")
    public class ViewController {
        @RequestMapping("/userList")
        public String index(){
            return "list";
        }
    }
    

    相关文章

      网友评论

          本文标题:Spring Boot MVC

          本文链接:https://www.haomeiwen.com/subject/pzizzftx.html