How do you work with Spring?



  • -main
    -webapp
      --resources
         ---folder
    -WEB-INF
    -test
    

    Classic web project structure. I need to process files in the file. folder

    Like I do: getClass().getClassLoader().getResource("folder") Then I'm doing this file, etc.

    Can you tell me what other ways to work with resources in spring?



  • Spring has a class family to work with resources (in this context, the resource is what can be obtained InputStream) They all operate the interface. http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/io/Resource.html :

    • ClassPathResource enables resources throughout CLASSPATH
    • ByteArrayResource Turns the White Massive into a resource.
    • UrlResource Permits to URL or file resources (URL with a scheme) file:)
    • FileSystemResource only to work with the file system.
    • PathResource Works with the tracksPath) of java.nio



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2