title: Error creating bean Bean instantiation via constructor failed
body: <p>Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate Constructor threw exception; nested exception is java.lang.NullPointerException</p>
  
  <p>The exception is getting thrown in this class:</p>
  
  <pre><code>package com.GDSWebService.tripnomics_GDS_integration.connector.travelport;
  
  import javax.xml.ws.BindingProvider;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import com.GDSWebService.tripnomics_GDS_integration.config.travelport.APIAccessConfig;
  import com.GDSWebService.tripnomics_GDS_integration.modal.TravelportCredentials;
  import com.GDSWebService.tripnomics_GDS_integration.service.HotelSearchImpl;
  import com.GDSWebService.tripnomics_GDS_integration.utils.BindingUtil;
  import com.travelport.schema.hotel_v48_0.BaseHotelSearchRsp;
  import com.travelport.schema.hotel_v48_0.HotelSearchAvailabilityReq;
  import com.travelport.service.hotel_v48_0.HotelSearchServicePortType;
  import com.travelport.service.hotel_v48_0.HotelService;
  
  @Component
  public class HotelSearchConnector {
  
      @Autowired
      public APIAccessConfig apiAccessConfig;
      @Autowired
      public HotelSearchImpl hotelSearchImpl;
  
      public TravelportCredentials travelportCredentials= apiAccessConfig.getAPIAccess();
  
      public HotelSearchServicePortType hotelShop;
      public HotelService hotelShopService;
  
      @Autowired
      public HotelSearchConnector() {
          this.hotelShopService= new com.travelport.service.hotel_v48_0.HotelService();
          this.hotelShop= hotelShopService.getHotelSearchServicePort();
      }
  
      public void hotelSearch(HotelSearchAvailabilityReq hsaReq) {
  
          BaseHotelSearchRsp hsaRsp= new BaseHotelSearchRsp();
  
          BindingUtil.addParametersToProvider((BindingProvider)hotelShop, travelportCredentials);
  
          hotelSearchImpl.hotelLowFareSearch(hsaReq, hsaRsp, hotelShop);
      }
  }
  </code></pre>
  
  <p>and based on the stack trace this the class which getting referred in line 25 </p>
  
  <pre><code>package com.GDSWebService.tripnomics_GDS_integration.config.travelport;
  
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.PropertySource;
  
  import com.GDSWebService.tripnomics_GDS_integration.modal.TravelportCredentials;
  
  @Configuration
  @PropertySource("classpath:application.properties")
  public class APIAccessConfig {
  
      private TravelportCredentials tpc= new TravelportCredentials();
  
      @Value("${GDS.travelport.endpoint}")
      private String endpoint;
      @Value("${GDS.travelport.username}")
      private String username;
      @Value("${GDS.travelport.password}")
      private String password;
      @Value("${GDS.travelport.targetbranch}")
      private String targetBranch;
  
  
      public TravelportCredentials getAPIAccess() {
  //      tpc= new TravelportCredentials();
  
          tpc.setEndpoint(endpoint);
          tpc.setPassword(password);
          tpc.setTargetBranch(targetBranch);
          tpc.setUsername(username);
  
          return tpc;
      }
  
  }
  </code></pre>
  
  <p>full Stack Trace:</p>
  
  <pre><code>Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2019-07-25 15:47:09.528 ERROR 7820 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hotelSearchConnector' defined in file [C:\Users\TravelSpends\Documents\Tripnomics\tripnomics-GDS-integration\target\classes\com\GDSWebService\tripnomics_GDS_integration\connector\travelport\HotelSearchConnector.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.GDSWebService.tripnomics_GDS_integration.connector.travelport.HotelSearchConnector]: Constructor threw exception; nested exception is java.lang.NullPointerException
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:171) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
      at com.GDSWebService.tripnomics_GDS_integration.App.main(App.java:26) [classes/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
      at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.4.RELEASE.jar:2.1.4.RELEASE]
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.GDSWebService.tripnomics_GDS_integration.connector.travelport.HotelSearchConnector]: Constructor threw exception; nested exception is java.lang.NullPointerException
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      ... 24 common frames omitted
  Caused by: java.lang.NullPointerException: null
      at com.GDSWebService.tripnomics_GDS_integration.connector.travelport.HotelSearchConnector.&lt;init&gt;(HotelSearchConnector.java:25) ~[classes/:na]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_201]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_201]
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_201]
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_201]
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      ... 26 common frames omitted
  </code></pre>
  
  <p>BaseHotelSearchRsp.java</p>
  
  <pre><code>package com.travelport.schema.hotel_v48_0;
  
  import java.util.ArrayList;
  import java.util.List;
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlAttribute;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlSeeAlso;
  import javax.xml.bind.annotation.XmlType;
  import com.travelport.schema.common_v48_0.BaseSearchRsp;
  import com.travelport.schema.common_v48_0.HostToken;
  import com.travelport.schema.common_v48_0.MarketingInformation;
  
  
  /**
   * 
   *                 Base hotel Search Response
   *             
   * 
   * &lt;p&gt;Java class for BaseHotelSearchRsp complex type.
   * 
   * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
   * 
   * &lt;pre&gt;
   * &amp;lt;complexType name="BaseHotelSearchRsp"&amp;gt;
   *   &amp;lt;complexContent&amp;gt;
   *     &amp;lt;extension base="{http://www.travelport.com/schema/common_v48_0}BaseSearchRsp"&amp;gt;
   *       &amp;lt;sequence&amp;gt;
   *         &amp;lt;element name="ReferencePoint" type="{http://www.travelport.com/schema/hotel_v48_0}typeHotelReferencePoint" minOccurs="0"/&amp;gt;
   *         &amp;lt;element ref="{http://www.travelport.com/schema/hotel_v48_0}HotelSearchResult" maxOccurs="999" minOccurs="0"/&amp;gt;
   *         &amp;lt;element ref="{http://www.travelport.com/schema/common_v48_0}MarketingInformation" minOccurs="0"/&amp;gt;
   *         &amp;lt;element ref="{http://www.travelport.com/schema/common_v48_0}HostToken" minOccurs="0"/&amp;gt;
   *       &amp;lt;/sequence&amp;gt;
   *       &amp;lt;attribute name="AddressSearchQuality" type="{http://www.w3.org/2001/XMLSchema}int" /&amp;gt;
   *     &amp;lt;/extension&amp;gt;
   *   &amp;lt;/complexContent&amp;gt;
   * &amp;lt;/complexType&amp;gt;
   * &lt;/pre&gt;
   * 
   * 
   */
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "BaseHotelSearchRsp", propOrder = {
      "referencePoint",
      "hotelSearchResult",
      "marketingInformation",
      "hostToken"
  })
  @XmlSeeAlso({
      RetrieveHotelSearchAvailabilityRsp.class,
      HotelSearchAvailabilityAsynchRsp.class
  })
  public class BaseHotelSearchRsp
      extends BaseSearchRsp
  {
  
      @XmlElement(name = "ReferencePoint")
      protected TypeHotelReferencePoint referencePoint;
      @XmlElement(name = "HotelSearchResult")
      protected List&lt;HotelSearchResult&gt; hotelSearchResult;
      @XmlElement(name = "MarketingInformation", namespace = "http://www.travelport.com/schema/common_v48_0")
      protected MarketingInformation marketingInformation;
      @XmlElement(name = "HostToken", namespace = "http://www.travelport.com/schema/common_v48_0")
      protected HostToken hostToken;
      @XmlAttribute(name = "AddressSearchQuality")
      protected Integer addressSearchQuality;
  
      /**
       * Gets the value of the referencePoint property.
       * 
       * @return
       *     possible object is
       *     {@link TypeHotelReferencePoint }
       *     
       */
      public TypeHotelReferencePoint getReferencePoint() {
          return referencePoint;
      }
  
      /**
       * Sets the value of the referencePoint property.
       * 
       * @param value
       *     allowed object is
       *     {@link TypeHotelReferencePoint }
       *     
       */
      public void setReferencePoint(TypeHotelReferencePoint value) {
          this.referencePoint = value;
      }
  
      /**
       * Gets the value of the hotelSearchResult property.
       * 
       * &lt;p&gt;
       * This accessor method returns a reference to the live list,
       * not a snapshot. Therefore any modification you make to the
       * returned list will be present inside the JAXB object.
       * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the hotelSearchResult property.
       * 
       * &lt;p&gt;
       * For example, to add a new item, do as follows:
       * &lt;pre&gt;
       *    getHotelSearchResult().add(newItem);
       * &lt;/pre&gt;
       * 
       * 
       * &lt;p&gt;
       * Objects of the following type(s) are allowed in the list
       * {@link HotelSearchResult }
       * 
       * 
       */
      public List&lt;HotelSearchResult&gt; getHotelSearchResult() {
          if (hotelSearchResult == null) {
              hotelSearchResult = new ArrayList&lt;HotelSearchResult&gt;();
          }
          return this.hotelSearchResult;
      }
  
      /**
       * Gets the value of the marketingInformation property.
       * 
       * @return
       *     possible object is
       *     {@link MarketingInformation }
       *     
       */
      public MarketingInformation getMarketingInformation() {
          return marketingInformation;
      }
  
      /**
       * Sets the value of the marketingInformation property.
       * 
       * @param value
       *     allowed object is
       *     {@link MarketingInformation }
       *     
       */
      public void setMarketingInformation(MarketingInformation value) {
          this.marketingInformation = value;
      }
  
      /**
       * Gets the value of the hostToken property.
       * 
       * @return
       *     possible object is
       *     {@link HostToken }
       *     
       */
      public HostToken getHostToken() {
          return hostToken;
      }
  
      /**
       * Sets the value of the hostToken property.
       * 
       * @param value
       *     allowed object is
       *     {@link HostToken }
       *     
       */
      public void setHostToken(HostToken value) {
          this.hostToken = value;
      }
  
      /**
       * Gets the value of the addressSearchQuality property.
       * 
       * @return
       *     possible object is
       *     {@link Integer }
       *     
       */
      public Integer getAddressSearchQuality() {
          return addressSearchQuality;
      }
  
      /**
       * Sets the value of the addressSearchQuality property.
       * 
       * @param value
       *     allowed object is
       *     {@link Integer }
       *     
       */
      public void setAddressSearchQuality(Integer value) {
          this.addressSearchQuality = value;
      }
  
  }
  </code></pre>
  
  <p>Kindly help guys I am a newbie to Spring Boot</p>