micronaut-projects/micronaut-core

Add method to ResourceResolver to retrieve a directory

Aperta

#1000 aperta il 4 dic 2018

 (8 commenti) (1 reazione) (0 assegnatari)Java (1025 fork)batch import
help wantedinfo: good first issuepriority: lowtype: improvement

Metriche repository

Star
 (5882 stelle)
Metriche merge PR
 (Merge medio 18g 12h) (60 PR mergiate in 30 g)

Descrizione

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)

Guida contributor