micronaut-projects/micronaut-core

Add method to ResourceResolver to retrieve a directory

开放

#1,000 创建于 2018年12月4日

 (8 条评论) (1 个反应) (0 位负责人)Java (1,025 个派生)batch import
help wantedinfo: good first issuepriority: lowtype: improvement

仓库指标

星标
 (5,882 个星标)
PR 合并指标
 (平均合并 18天 12小时) (30 天内合并 60 个 PR)

描述

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a file somefile.txt in src/main/resources/somedir.
  2. Inject the ResourceResolver.
  3. Call resourceResolver.getResource("classpath:somedir/")--> this returns Optional.empty but reference to directory expected.

Note that getting the somefile.txt resource directly via resourceResolver.getResource("classpath:somedir/somefile.txt") dies return the resource.

My current alternative is val dir = MyClass::class.java.getResource("/somedir/").

Expected Behaviour

ResourceResolver.getResource should return URI pointing to directory.

Actual Behaviour

Optional.empty returned.

Environment Information

  • Operating System: OSX
  • Micronaut Version: 1.0.1
  • JDK Version: JDK8 (Kotlin)

贡献者指南