zoukankan      html  css  js  c++  java
  • Maven CXF wsdl2java XMLGregorianCalendar类型更改

    jaxb-bindings.xml配置:

    <?xml version="1.0" encoding="UTF-8"?>
    <jaxb:bindings version="2.1"
                  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema"
                  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
    
        <jaxb:globalBindings generateElementProperty="false">
            <!-- use Calendar instead of XMLGregorianCalendar -->
            <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
                parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
                printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
            <jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
                parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
                printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
            <jaxb:javaType name="java.util.Calendar" xmlType="xs:time"
                parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
                printMethod="javax.xml.bind.DatatypeConverter.printTime"/>
            
            <!-- use Calendar Date instead of XMLGregorianCalendar
            <jaxb:javaType name="java.util.Date" xmlType="xs:dateTime"
                      parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDateTime"
                      printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime"/>
            <jaxb:javaType name="java.util.Date" xmlType="xs:date"
                      parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDate"
                      printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDate"/>
            <jaxb:javaType name="java.util.Date" xmlType="xs:time"
                      parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseTime"
                      printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printTime"/>
             -->
        </jaxb:globalBindings>       
         
    </jaxb:bindings>

    转载:

    https://stackoverflow.com/questions/21287429/unable-to-generate-java-util-calendar-from-xsd-getting-xmlgregoriancalendar

    https://stackoverflow.com/questions/12513361/jaxb-custom-bindings-adapter1-class-and-joda-time/27380200

  • 相关阅读:
    异常介绍
    docker 命令
    acm
    Openfiler能把标准x86/64架构的系统变成一个强大的NAS、SAN存储和IP存储网关
    docker 图解学习
    基于Docker的TensorFlow机器学习框架搭建和实例源码解读
    菜鸟打印控件
    Oracle 12c on Solaris 10 安装文档
    内存对齐小解
    安装oracle 11gr2 rac on solaris
  • 原文地址:https://www.cnblogs.com/boazy/p/9254534.html
Copyright © 2011-2022 走看看