如何在JBoss AS 7中禁用扫描@WebService注释?

时间:2012-10-23 03:04:39

标签: web-services spring cxf jboss7.x

我使用Spring + ApacheCXF开发了Web服务,我需要在JBoss AS7上使用它们。 它们正在由CXFServlet正确部署。

但是JBoss AS7也通过扫描@WebService注释来部署它们(正如预期的那样没有Spring注入)。

如何在JBoss AS 7中禁用扫描@WebService注释?

PS:我正在部署为.war文件。

PS PS: 我正在正确部署我当前的cxf webservices。但是JBoss AS7也试图扫描@WebService类并部署它们(没有依赖注入)。我正在寻找一种方法来转换JBossAS7扫描@WebService类。

4 个答案:

答案 0 :(得分:3)

这也适用于Jboss 6。我在Jboss 6.2.2上尝试过。 在standalone.xml中注释以下内容

<!-- <extension module="org.jboss.as.webservices"/> -->

然后在同一个standalone.xml中注释下面的代码段。请注意,如果您使用的是不同的个人资料名称或在域名模式下,则必须在类似的地方进行此操作。

<!-- 
    <subsystem xmlns="urn:jboss:domain:webservices:1.2">
        <modify-wsdl-address>true</modify-wsdl-address>
        <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
        <endpoint-config name="Standard-Endpoint-Config"/>
        <endpoint-config name="Recording-Endpoint-Config">
            <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
            </pre-handler-chain>
        </endpoint-config>
        <client-config name="Standard-Client-Config"/>
    </subsystem>
     -->

答案 1 :(得分:2)

我相信您会想要从standalone.xml中删除它

<extension module="org.jboss.as.webservices"/>

<subsystem xmlns="urn:jboss:domain:webservices:1.1">
    <modify-wsdl-address>true</modify-wsdl-address>
    <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
    <endpoint-config name="Standard-Endpoint-Config"/>
    <endpoint-config name="Recording-Endpoint-Config">
        <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
        <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
        </pre-handler-chain>
    </endpoint-config>
</subsystem>

这是我删除jboss webservices所做的,所以我可以使用其他东西。我仍然在测试它,但它不再部署服务。我假设我将能够使用spring来部署。希望这会有所帮助。

答案 2 :(得分:1)

我在应用程序上下文XML文件中使用exclude-filter从Spring组件扫描中排除Web服务组件。

<context:component-scan base-package="your.application.base.package">
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
    <context:exclude-filter type="annotation" expression="javax.jws.WebService" />
</context:component-scan>

同时我将它们包含在CXF上下文XML中的组件扫描中。

答案 3 :(得分:0)

我使用JBoss EAP 6.1,我解决了排除子系统jaxrs和webservices的相同问题。

的JBoss部署-structure.xml

    <?xml version="1.0"?>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
        <deployment>
            <exclude-subsystems>
                <subsystem name="jaxrs" />
                <subsystem name="webservices" />
            </exclude-subsystems>
            <exclusions>
                <module name="javaee.api" />
                <module name="org.apache.log4j" />
            </exclusions>
            <dependencies>
                <module meta-inf="export" name="com.liferay.portal">
                    <imports>
                            <include path="META-INF" />
                    </imports>
                </module>
                <module name="javax.mail.api" />
                <module name="org.jboss.modules" />
            </dependencies>
        </deployment>
</jboss-deployment-structure>