I have a maven Spring project, there is xml file inside src/main/resources/xyz.xml. How can I read it inside spring MVC controller.
I am us
Best working code in Dec 14, 2019 (Spring version 5.1.0.RELEASE)
import org.springframework.core.io.Resource;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.io.InputStream;
Resource resource = new ClassPathResource("xyz.xml");
InputStream input = resource.getInputStream();
File file = resource.getFile();
See this for more details