Spring boot 打jar包获取static 目录下配置文件

普通情况下可以获得static目录,可是打jar后就获取不到了,因为没有tagert目录

之前是通过下面方法进行获取,可是打jar包后过去不到了

files = new File(ResourceUtils.getURL("classpath:static").getPath());

 获取方法

         ClassPathResource resource = new ClassPathResource("static/socketlist.xml");

            InputStream in = resource.getInputStream();

 

posted on 2023-04-24 16:41  手撕高达的村长  阅读(421)  评论(0)    收藏  举报

导航