DataSource 不能为 null Spring 启动 2.5.7 升级 - JUnit 测试用例失败
DataSource Must not be null Spring boot 2.5.7 Upgrade- JUnit testcase fails
This is my data source code
这里是一些描述。
java。郎。 IllegalArgumentException: DataSource 不能为 null
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.jdbc.datasource.lookup.SingleDataSourceLookup.<init>(SingleDataSourceLookup.java:40)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setDataSource(LocalContainerEntityManagerFactoryBean.java:257)
at org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder$Builder.build(EntityManagerFactoryBuilder.java:234)
at com.cardinalhealth.nphsden.framework.utils.DbUtils.getEntityManagerFactory(DbUtils.java:38)
at com.cardinalhealth.nphsden.framework.utils.DbUtilsTest.testGetEntityManagerFactory(DbUtilsTest.java:53)
使用这个 - >
pgDataSource = dataSourceBuilder.create().build();
而不是 ->
pgDataSource = dataSourceBuilder.build();
This is my data source code
这里是一些描述。 java。郎。 IllegalArgumentException: DataSource 不能为 null
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.jdbc.datasource.lookup.SingleDataSourceLookup.<init>(SingleDataSourceLookup.java:40)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setDataSource(LocalContainerEntityManagerFactoryBean.java:257)
at org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder$Builder.build(EntityManagerFactoryBuilder.java:234)
at com.cardinalhealth.nphsden.framework.utils.DbUtils.getEntityManagerFactory(DbUtils.java:38)
at com.cardinalhealth.nphsden.framework.utils.DbUtilsTest.testGetEntityManagerFactory(DbUtilsTest.java:53)
使用这个 - > pgDataSource = dataSourceBuilder.create().build();
而不是 -> pgDataSource = dataSourceBuilder.build();