Spring 3.0 inject files as resources

后端 未结 5 1395
星月不相逢
星月不相逢 2020-12-15 15:27

In my Spring 3.0 app, I have some resources in /WEB-INF/dir. At runtime I need some of them as an InputStream (or some other type). How can I retri

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 15:53

    Here is an easiest way to do it via annotation:

    import org.springframework.core.io.Resource;
    
    @Value("classpath:")
    private Resource cert;
    

提交回复
热议问题