自动休眠模式创建不起作用 (junit+spring)

Automatic hibernate schema creation not working (junit+spring)

我是 运行 具有以下 spring 配置的 JUnit 测试用例。没有自动创建架构。

@Configuration
public class DatabaseConfiguration {

    @Bean
    DataSource dataSource() {
        BasicDataSource ret = new BasicDataSource();
        ret.setDriverClassName("com.mysql.jdbc.Driver");
        ret.setUrl("jdbc:mysql://localhost:3306/mydb");
        ret.setUsername("root");
        ret.setPassword("root");
        return ret;
    }


    @Bean
    SessionFactory sessionFactoryBean(DataSource dataSource) {
        LocalSessionFactoryBuilder sessionBuilder = new LocalSessionFactoryBuilder(
                dataSource);
        sessionBuilder.scanPackages("com.mypackage.domain");
        sessionBuilder.addProperties(getHibernateProperties());
        return sessionBuilder.buildSessionFactory();
    }

    private Properties getHibernateProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.show_sql", "true");
        properties.put("hbm2ddl.auto", "create");
        properties.put("hibernate.dialect",
                "org.hibernate.dialect.MySQLDialect");
        return properties;
    }

    @Bean
    HibernateTransactionManager transactionManager(SessionFactory lsfb) {
        HibernateTransactionManager mgr = new HibernateTransactionManager();
        mgr.setSessionFactory(lsfb);
        return mgr;
    }
}

我已经调试以确保模式创建实际上被跳过了。

知道为什么会跳过架构创建吗?

尝试使用 hibernate.hbm2ddl.auto 而不是 hbm2ddl..auto