[英]cxf spring boot schemalocations configuration
I would like to add to webConfWebService configuration class for my spring boot app a schema(xsd). 我想为我的Spring Boot应用程序的webConfWebService配置类添加一个schema(xsd)。
With xml configuration is as follows: 用xml配置如下:
<jaxws:endpoint address="/nameService" publishedEndpointUrl="">
<jaxws:implementor>
<bean class=name.pkg.ServiceWSImpl" />
</jaxws:implementor>
<jaxws:dataBinding>
<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
</jaxws:dataBinding>
<jaxws:serviceFactory>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false" />
</bean>
</jaxws:serviceFactory>
<jaxws:schemaLocations>
<jaxws:schemaLocation>classpath:META-INF/xsd/namexsd1.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:META-INF/xsd/namexsd12.xsd</jaxws:schemaLocation>
</jaxws:schemaLocations>
<jaxws:inInterceptors>
<ref bean="authInterceptor" />
</jaxws:inInterceptors>
<jaxws:properties>
<entry key="schema-validation-enabled" value="false" />
</jaxws:properties>
</jaxws:endpoint>
and with annotation i started to create my endPOint as follows and i am blocked to how to import the list of schemalocation, i don't know how to do it: 并使用批注,我开始如下创建endPOint,并且被禁止导入架构位置列表,我不知道该怎么做:
@Configuration
public class WebServiceConfig {
@Autowired
private Bus bus;
@Bean
public ServletRegistrationBean dispatcherSerlvet() {
return new ServletRegistrationBean(new CXFServlet(), "/services/*");
}
@Bean
public Endpoint namesServiceEndpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, new NameServiceImpl());
endpoint.publish("/Hello");
endpoint.setSchemaLocations(schemaLocations);//HERE ......
return endpoint;
}
It is by adding them in a list as follows: 通过将它们添加到列表中,如下所示:
List<String> schemaLocations = new ArrayList<String>();
Resource resource = resourceLoader.getResource(""classpath:/xsd/nameSchema.xsd);
schemaLocations.add(resource.getFile().getPath());
endpoint.setSchemaLocations(schemaLocations);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.