1. 使用ClasspathResource
import org.springframework.core.io.ClassPathResource; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(new ClassPathResource("myfile.xsd")); }
2. 使用Resouce或配置:
import org.springframework.core.io.Resource; @Value("classpath:myfile.xsd") private Resource res; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(res); }
猜你喜欢
本站原创《复杂软件设计之道:领域驱动设计全面解析与实战》