码迷,mamicode.com
首页 > 其他好文 > 详细

读取Resource 相对路径

时间:2020-05-13 15:21:18      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:directory   etc   路径   sys   jpg   canonical   can   ica   pat   

        File directory = new File("src/main/resources/static/pic");
        String courseFile = directory.getCanonicalPath();
        System.out.println(courseFile);

 资源映射

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.yml</include>
          <include>**/*.xml</include>
          <include>**/*.xls</include>
          <include>**/*.png</include>
          <include>**/*.jpg</include>
        </includes>
      </resource>
    </resources>

 

读取Resource 相对路径

标签:directory   etc   路径   sys   jpg   canonical   can   ica   pat   

原文地址:https://www.cnblogs.com/chenziyue/p/12882496.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!