content: package com.sap.refapps.espm.config;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import javax.sql.DataSource;
  
  import org.eclipse.persistence.config.PersistenceUnitProperties;
  import org.springframework.beans.factory.ObjectProvider;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
  import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver;
  import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
  import org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter;
  import org.springframework.transaction.jta.JtaTransactionManager;
  
  /**
   * This is the eclipse link config class.
   *
   */
  @Configuration
  @ComponentScan
  @EnableAutoConfiguration
  public class EspmJpaConfig extends JpaBaseConfiguration {
  
  	protected EspmJpaConfig(DataSource dataSource, JpaProperties properties,
  			ObjectProvider<JtaTransactionManager> jtaTransactionManager) {
  		super(dataSource, properties, jtaTransactionManager);
  	}
  
  	 /* (non-Javadoc)
  	 * @see org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#createJpaVendorAdapter()
  	 */
  	@Override
      protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
          EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
          return jpaVendorAdapter;
      }
  
      /* (non-Javadoc)
       * @see org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#getVendorProperties()
       */
      @Override
      protected Map<String, Object> getVendorProperties() {
          HashMap<String, Object> map = new HashMap<String, Object>();
          map.put(PersistenceUnitProperties.WEAVING, getWeavingMode());
          return map;
      }
      
      /**
       * Returns the weaving mode.
       * 
       * @return string
       */
      private String getWeavingMode() {
          return InstrumentationLoadTimeWeaver.isInstrumentationAvailable() ? "true" : "static";
      }
  
  }
  