简体   繁体   中英

Use Apache CXF wsdl2java to generate classes with full constructors

Is there a way to configure Apache CXF wsdl2java to generate a constructor with all of a classes fields in it? Right now only the empty default constructor is generated as well as void returning setters. This can result in very unwieldy code. I'm transitioning from axis 1.4 which did generate full constructors, so a lot of code is broken as a result.

I'm running wsdl2java from the command line. I'm not using maven/ant, just trying to generate the java files so a maven plugin will not work for me.

What you'd want to find is a JAXB plugin that makes this happen. I'm not aware of one. Instead of a constructor setting all fields, you're better off with fluent setters. There is a JAXB plugin to do that, called "jaxb-fluent-api". I would expect you could eventually build a nasty wsdl2java command line that does this, but you're better off writing an actual build script, using Maven hopefully.

See these examples of referencing JAXB extensions with the "cxf-codegen-plugin" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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