我自己做了一些调试,并在 org.springframework.context.support.AbstractApplicationContext 第 361 行设置了一个断点:
@Override
public void publishEvent(ApplicationEvent event) {
publishEvent(event, null);
}
因为event
我得到
-
2.3.7
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.GenericWebApplicationContext@10fbbdb, started on Thu Jan 14 12:56:38 CET 2021]
-
2.3.6
org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.web.context.support.GenericWebApplicationContext@57a2ed35, started on Thu Jan 14 12:59:35 CET 2021]
和
org.springframework.boot.autoconfigure.jdbc.DataSourceSchemaCreatedEvent[source=HikariDataSource (HikariPool-1)]
进一步挖掘org.springframework.orm.jpa.AbstractEntityManagerFactoryBean#buildNativeEntityManagerFactory
JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter();
if (jpaVendorAdapter != null) {
jpaVendorAdapter.postProcessEntityManagerFactory(emf);
}
org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher
@Override
public void postProcessEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.delegate.postProcessEntityManagerFactory(entityManagerFactory);
AsyncTaskExecutor bootstrapExecutor = this.factoryBean.getBootstrapExecutor();
if (bootstrapExecutor != null) {
DataSourceInitializedPublisher.this.initializationCompletionListener.dataSourceInitialization = bootstrapExecutor
.submit(() -> DataSourceInitializedPublisher.this.publishEventIfRequired(this.factoryBean,
entityManagerFactory));
}
}
为了完整起见,我还包含了具有以下设置的日志文件。
logging:
level:
#root: DEBUG
org:
hibernate:
SQL: DEBUG
type.descriptor.sql.BasicBinder: TRACE
springframework:
jdbc: DEBUG
core:
io: TRACE
orm: TRACE
boot.2.3.7.ormTRACE.log.gz
boot.2.3.6.ormTRACE.log.gz