CXF Spring引导示意图配置



我想添加到我的Spring Boot应用程序A架架(XSD(的WebConfwebservice配置类。

带有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>

,通过注释,我开始创建终点,如下所示,我对如何导入示意图列表被阻止,我不知道该怎么做:

@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;
    }

是通过在列表中添加它们,如下所示:

 List<String> schemaLocations = new ArrayList<String>();
            Resource resource = resourceLoader.getResource(""classpath:/xsd/nameSchema.xsd);
            schemaLocations.add(resource.getFile().getPath());

    endpoint.setSchemaLocations(schemaLocations);

最新更新