How do I load a resource and use its contents as a string in Spring

前端 未结 5 1030
春和景丽
春和景丽 2020-12-04 17:48

How can I load a Spring resource contents and use it to set a bean property or pass it as an argument constructor?

The resource contains free text.

5条回答
  •  难免孤独
    2020-12-04 17:54

    
        
    
    

    This solution requires Apache Commons IO.

    Another solution, suggested by @Parvez, without Apache Commons IO dependency is

    
        
            
                
                 
        
    
    

提交回复
热议问题