Browsed by
Tag: classpath

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects   Using ClasspathResource import org.springframework.core.io.ClassPathResource; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(new ClassPathResource("myfile.xsd")); }   Note: Here myfile.xsd should be located in src/main/resources. Using Resource import org.springframework.core.io.Resource; @Value("classpath:myfile.xsd") private Resource res; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(res); } 747 total views, 2 views today

747 total views, 2 views today