如何在Spring Boot和Gradle中启用eclipselink静态编织

时间:2019-07-09 07:33:07

标签: java gradle eclipselink

  1. 参与https://plugins.gradle.org/plugin/org.jamgo.eclipselink-plugin
  2. 检查日志 [EL警告]:元数据:ServerSession(1559673372)-由于未启用编织,或者为实体类[类com.hybris.caas.order.model.Order]还原了OneToOne或ManyToOne属性[copyCustomer]上的惰性设置。没发生。
   @Configuration
public class JpaConfig extends JpaBaseConfiguration {

   protected JpaConfig(DataSource dataSource, JpaProperties properties,
                       ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider,
                       ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
       super(dataSource, properties, jtaTransactionManagerProvider, transactionManagerCustomizers);
   }

   @Override
   protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
       return new EclipseLinkJpaVendorAdapter();
   }

   @Override
   protected Map<String, Object> getVendorProperties() {
       final HashMap<String, Object> props = new HashMap<>();
       props.put(PersistenceUnitProperties.WEAVING, detectWeavingMode());
       return props;
   }

   private String detectWeavingMode() {
       return "static";
   }

   /**
    *
    * @param entityManagerFactory
    * @return
    */
   @Bean
   public PlatformTransactionManager transactionManager(final EntityManagerFactory entityManagerFactory) {
       final JpaTransactionManager transactionManager = new JpaTransactionManager();
       transactionManager.setEntityManagerFactory(entityManagerFactory);
       return transactionManager;
   }

}
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.org.jamgo:eclipselink-plugin:0.2.2"
  }
}

apply plugin: "org.jamgo.eclipselink-plugin"

0 个答案:

没有答案