简体   繁体   English

Spring-WS-如何使用Maven插件通过JAXB启用MTOM

[英]Spring-WS - How to enable MTOM with JAXB using Maven plugin

Two questions about generating JAXB objects. 关于生成JAXB对象的两个问题。

What is the difference when the Jaxb is configured as shown in the two examples. 如两个示例所示配置Jaxb时有什么区别。

Using Maven 使用Maven

<plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/webapp/WEB-INF/schemas</schemaDirectory>
                </configuration>
            </plugin>

Using Spring configuration file 使用Spring配置文件

 <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="contextPath" value="org.springframework.ws.samples.mtom.schema"/>
        <property name="mtomEnabled" value="true"/>
    </bean>

Do the above two configuration achieve the same thing? 上面的两种配置实现相同的功能吗?

The second question is how do i enable MTOM using the Maven configuration method? 第二个问题是如何使用Maven配置方法启用MTOM?

They are two completely different things. 它们是完全不同的两件事。

the maven plugin will auto generate your jaxb entities based on your schema file during the generate-sources maven phase. Maven插件将在generate-sources maven阶段根据您的模式文件自动生成jaxb实体。

the second configurations sets up the jaxb marshaller and tells it that the jaxb entities are located at that contextPath. 第二种配置设置了jaxb marshaller,并告诉它jaxb实体位于该contextPath上。

so essentially maven is build time and the second configuration is runtime 所以本质上,maven是构建时间,第二个配置是运行时

for you second question. 给你第二个问题。 MTOM has nothing to do with maven. MTOM与Maven无关。 they way i got it working was by downloading the spring-ws code and there is a nice sample in there which is very helpful. 他们让我工作的方式是下载spring-ws代码,并且那里有一个很好的示例,这非常有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM