为什么添加@EnableAutoConfiguration到以下spring-boot应用程序会导致它无法创建entityManagerFactory?如果我删除@EnableAutoConfiguration一切正常.任何人都可以阐明这种行为吗?
package test.builder;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import test.builder.jpa.entity.Builder;
import test.builder.jpa.repository.BuilderRepository;
@Configuration
// @EnableAutoConfiguration
@EnableJpaRepositories("test.builder")
@PropertySource("classpath:application.properties")
public class BootApp implements CommandLineRunner {
private static Logger logger = LoggerFactory.getLogger(BootApp.class);
@Value("${spring.datasource.driverClassName}")
private String databaseDriverClassName;
@Value("${spring.datasource.url}")
private String datasourceUrl;
@Value("${spring.datasource.username}")
private String databaseUsername; …Run Code Online (Sandbox Code Playgroud)