wsimport生成没有参数化构造函数的源代码.因此,如果bean具有许多属性,则需要手动调用所有setter:
Person person = new Person();
person.setName("Alex");
Address address = new Address();
address.setCity("Rome");
person.setAddress(address);
只需编写如下代码,它就更具可读性和便捷性:
Person person = new Person("Alex", new Address("Rome"))
那么,有没有办法wsimport做这个工作?(我正在使用maven wsimport插件)
我使用wsimport的WSDL生成的类没有equals()和hashcode()方法.如何自定义和生成客户端类以获取equals()和hashcode()方法.
我不确定使用JAXB来实现这一点.
在Axis2.0生成的存根中生成了这些方法,但不确定为什么JAXWS中没有这样的基本功能!
我想从我的 wsdl 中重载 toString 方法。
在我的 pom.xml 中
我在依赖项中添加了它:
<dependency>
    <groupId>org.jvnet.jaxb2_commons</groupId>
    <artifactId>jaxb2-basics-runtime</artifactId>
    <version>1.11.1</version>
</dependency>
我在 build/plugins 中添加了这个插件
块引用
<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.7.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${project.build.directory}/wsdl/META-INF/wsdl/</schemaDirectory>
                <schemaIncludes>
                    <include>FrameworkGedServiceMetier.wsdl</include>
                </schemaIncludes>
                <args>
                    <arg>-XtoString</arg>
                    <arg>-Xequals</arg>
                    <arg>-XhashCode</arg>
                    <arg>-Xcopyable</arg>
                </args>
                <plugins>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>1.11.1</version>
                    </plugin>
                </plugins>
            </configuration>
        </plugin> 
我构建maven 成功,但我的类中没有我的方法toString。