使用Spring Boot

时间:2019-06-08 17:57:07

标签: java spring spring-boot sybase sqlanywhere

我想将Spring Boot应用程序连接到SQLAnywhere,但是我不知道如何配置它。

public class DatabaseConfig {
    @Bean(name = "dataSource")
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource dataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "managerFactory")
    public LocalContainerEntityManagerFactoryBean managerFactory(
        EntityManagerFactoryBuilder builder,
        @Qualifier("dataSource") DataSource dataSource) {

        return builder
            .dataSource(dataSource)
            .packages("fr.dor.model.entity")
            .persistenceUnit("dorPU")
            .build();
    }

    @Bean(name = "transactionManager")
    public PlatformTransactionManager transactionManager(
        @Qualifier("managerFactory") EntityManagerFactory managerFactory) {
        return new JpaTransactionManager(managerFactory);
    }
}

我有此错误:

  

org.springframework.beans.factory.BeanCreationException:在类路径资源[fr / dor / configuration / DatabaseConfig.class]中创建名称为'managerFactory'的bean时出错:调用init方法失败;嵌套的异常是java.lang.AbstractMethodError

0 个答案:

没有答案