Десериализация Джексона не работает в Java 17JAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Десериализация Джексона не работает в Java 17

Сообщение Anonymous »

Приведенный ниже код отлично работает с версией загрузки Spring до 2.7.17: -

Код: Выделить всё

protected Customer getCustomerFromURI(String resourceId) {
    Map  uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId);
    String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId);
    org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId);
    if (customerAAI != null) {
      return mapperLayer.mapAAICustomer(customerAAI);
    } else {
      return null;
    }
  }
Мой клиент классифицируется следующим образом:-

Код: Выделить всё

package org.onap.aai.domain.yang;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.onap.aai.annotations.Metadata;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
  "globalCustomerId",
  "subscriberName",
  "subscriberType",
  "dataOwner",
  "dataSource",
  "dataSourceVersion",
  "resourceVersion",
  "serviceSubscriptions",
  "relationshipList"
})
@XmlRootElement(name = "customer")
@Metadata(description = "customer identifiers to provide linkage back to BSS information.", nameProps = "subscriber-name", indexedProps = "subscriber-name,global-customer-id,subscriber-type,data-owner,data-source,data-source-version", searchable = "global-customer-id,subscriber-name", uniqueProps = "global-customer-id", container = "customers", namespace = "business", uriTemplate = "/business/customers/customer/{global-customer-id}", requiredProps = "global-customer-id,subscriber-name,subscriber-type")
public class Customer implements Serializable, ToString2
{

  private final static long serialVersionUID = 16L;
  @XmlElement(name = "global-customer-id")
  @Metadata(isKey = true, description = "Global customer id used across ONAP to uniquely identify customer.")
  protected String globalCustomerId;
  @XmlElement(name = "subscriber-name")
  @Metadata(description = "Subscriber name, an alternate way to retrieve a customer.")
  protected String subscriberName;
  @XmlElement(name = "subscriber-type")
  @Metadata(description = "Subscriber type, a way to provide VID with only the INFRA customers.", defaultValue = "CUST")
  protected String subscriberType;
  @XmlElement(name = "data-owner")
  @Metadata(description = "Identifies the entity that is responsible managing this inventory object.")
  protected String dataOwner;
  @XmlElement(name = "data-source")
  @Metadata(description = "Identifies the upstream source of the data.")
  protected String dataSource;
  @XmlElement(name = "data-source-version")
  @Metadata(description = "Identifies the version of the upstream source.")
  protected String dataSourceVersion;
  @XmlElement(name = "resource-version")
  @Metadata(description = "Used for optimistic concurrency. Must be empty on create,  valid on update and delete.")
  protected String resourceVersion;
  @XmlElement(name = "service-subscriptions")
  protected ServiceSubscriptions serviceSubscriptions;
  @XmlElement(name = "relationship-list")
  protected RelationshipList relationshipList;

  /**
   * Gets the value of the globalCustomerId property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getGlobalCustomerId() {
    return globalCustomerId;
  }

  /**
   * Sets the value of the globalCustomerId property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setGlobalCustomerId(String value) {
    this.globalCustomerId = value;
  }

  /**
   * Gets the value of the subscriberName property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getSubscriberName() {
    return subscriberName;
  }

  /**
   * Sets the value of the subscriberName property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setSubscriberName(String value) {
    this.subscriberName = value;
  }

  /**
   * Gets the value of the subscriberType property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getSubscriberType() {
    return subscriberType;
  }

  /**
   * Sets the value of the subscriberType property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setSubscriberType(String value) {
    this.subscriberType = value;
  }

  /**
   * Gets the value of the dataOwner property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getDataOwner() {
    return dataOwner;
  }

  /**
   * Sets the value of the dataOwner property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setDataOwner(String value) {
    this.dataOwner = value;
  }

  /**
   * Gets the value of the dataSource property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getDataSource() {
    return dataSource;
  }

  /**
   * Sets the value of the dataSource property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setDataSource(String value) {
    this.dataSource = value;
  }

  /**
   * Gets the value of the dataSourceVersion property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getDataSourceVersion() {
    return dataSourceVersion;
  }

  /**
   * Sets the value of the dataSourceVersion property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setDataSourceVersion(String value) {
    this.dataSourceVersion = value;
  }

  /**
   * Gets the value of the resourceVersion property.
   * 
   * @return
   *   possible object is
   *   {@link String }
   *   
   */
  public String getResourceVersion() {
    return resourceVersion;
  }

  /**
   * Sets the value of the resourceVersion property.
   * 
   * @param value
   *   allowed object is
   *   {@link String }
   *   
   */
  public void setResourceVersion(String value) {
    this.resourceVersion = value;
  }

  /**
   * Gets the value of the serviceSubscriptions property.
   * 
   * @return
   *   possible object is
   *   {@link ServiceSubscriptions }
   *   
   */
  public ServiceSubscriptions getServiceSubscriptions() {
    return serviceSubscriptions;
  }

  /**
   * Sets the value of the serviceSubscriptions property.
   * 
   * @param value
   *   allowed object is
   *   {@link ServiceSubscriptions }
   *   
   */
  public void setServiceSubscriptions(ServiceSubscriptions value)  {
    this.serviceSubscriptions = value;
  }

  /**
   * Gets the value of the relationshipList property.
   * 
   * @return
   *   possible object is
   *   {@link RelationshipList }
   *   
   */
  public RelationshipList getRelationshipList() {
    return relationshipList;
  }

  /**
   * Sets the value of the relationshipList property.
   * 
   * @param value
   *   allowed object is
   *   {@link RelationshipList }
   *   
   */
  public void setRelationshipList(RelationshipList value) {
    this.relationshipList = value;
  }

  public String toString() {
    final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE;
    final StringBuilder buffer = new StringBuilder();
    append(null, buffer, strategy);
    return buffer.toString();
  }

  public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
    strategy.appendStart(locator, this, buffer);
    appendFields(locator, buffer, strategy);
    strategy.appendEnd(locator, this, buffer);
    return buffer;
  }

  public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
    {
      String theGlobalCustomerId;
      theGlobalCustomerId = this.getGlobalCustomerId();
      strategy.appendField(locator, this, "globalCustomerId", buffer, theGlobalCustomerId, (this.globalCustomerId!= null));
    }
    {
      String theSubscriberName;
      theSubscriberName = this.getSubscriberName();
      strategy.appendField(locator, this, "subscriberName", buffer, theSubscriberName, (this.subscriberName!= null));
    }
    {
      String theSubscriberType;
      theSubscriberType = this.getSubscriberType();
      strategy.appendField(locator, this, "subscriberType", buffer, theSubscriberType, (this.subscriberType!= null));
    }
    {
      String theDataOwner;
      theDataOwner = this.getDataOwner();
      strategy.appendField(locator, this, "dataOwner", buffer, theDataOwner, (this.dataOwner!= null));
    }
    {
      String theDataSource;
      theDataSource = this.getDataSource();
      strategy.appendField(locator, this, "dataSource", buffer, theDataSource, (this.dataSource!= null));
    }
    {
      String theDataSourceVersion;
      theDataSourceVersion = this.getDataSourceVersion();
      strategy.appendField(locator, this, "dataSourceVersion", buffer, theDataSourceVersion, (this.dataSourceVersion!= null));
    }
    {
      String theResourceVersion;
      theResourceVersion = this.getResourceVersion();
      strategy.appendField(locator, this, "resourceVersion", buffer, theResourceVersion, (this.resourceVersion!= null));
    }
    {
      ServiceSubscriptions theServiceSubscriptions;
      theServiceSubscriptions = this.getServiceSubscriptions();
      strategy.appendField(locator, this, "serviceSubscriptions", buffer, theServiceSubscriptions, (this.serviceSubscriptions!= null));
    }
    {
      RelationshipList theRelationshipList;
      theRelationshipList = this.getRelationshipList();
      strategy.appendField(locator, this, "relationshipList", buffer, theRelationshipList, (this.relationshipList!= null));
    }
    return buffer;
  }

}

public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) {
return injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.Customer.class,
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)))
.orElse(null);
}
В приведенном выше методе AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId) выдает выходные данные в виде {"global-customer-id":"12","subscriber-name" :"abc"}, и он правильно сопоставляется с org.onap.aai.domain.yang.Customer.
Но если я обновлюсь до Springboot 3+ и java17, он не будет сопоставлен, и я получу ноль.

Подробнее здесь: https://stackoverflow.com/questions/788 ... in-java-17
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Десериализация Джексона не работает в Java 17
    Anonymous » » в форуме JAVA
    0 Ответы
    6 Просмотры
    Последнее сообщение Anonymous
  • Полиморфная десериализация многоуровневого наследования через Джексона в Java
    Anonymous » » в форуме JAVA
    0 Ответы
    40 Просмотры
    Последнее сообщение Anonymous
  • XML-десериализация Джексона java.awt.Color из атрибутов «r», «g», «b», «a»?
    Anonymous » » в форуме JAVA
    0 Ответы
    16 Просмотры
    Последнее сообщение Anonymous
  • XML-десериализация Джексона java.awt.Color из атрибутов «r», «g», «b», «a»?
    Anonymous » » в форуме JAVA
    0 Ответы
    25 Просмотры
    Последнее сообщение Anonymous
  • XML-десериализация Джексона java.awt.Color из атрибутов «r», «g», «b», «a»?
    Anonymous » » в форуме JAVA
    0 Ответы
    19 Просмотры
    Последнее сообщение Anonymous

Вернуться в «JAVA»