zoukankan      html  css  js  c++  java
  • springboot+thymeleaf 访问静态资源解决(static)

    ---------------------------------------2.1.3------------------------------------------------------------------

    第一步:pom.xml-必须有这个

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

    第二步:application.properties

    spring.mvc.static-path-pattern=/static/**


    访问js路径就是:

    http://localhost:8081/static/js/jquery.min.js

    界面html里面引用路径
    <script src="/static/js/jquery.min.js"></script>

    -----------------------------原来我用的是2.1.3 改成 2.0.2一切都解决了(/static/也不用加了)-----------------------------------------------
    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
    </parent>
     
  • 相关阅读:
    第二章Maven安装与配置
    第一章 Maven简介
    什么是Maven?
    jbpm与OA项目-oa概念
    Hadoop学习常用的Linux命令
    包名命名规则
    判断网络类型
    webview的设置
    AlertDialog的实现
    SharedPreferences保存用户偏好参数
  • 原文地址:https://www.cnblogs.com/duanqiao123/p/10488031.html
Copyright © 2011-2022 走看看