Skip to content

Commit e5d967d

Browse files
authored
Merge pull request #797 from SkyAndCode/change-sqlsessionfactory-event-type
fix: change the event type that SqlSessionFactory is listening to
2 parents 4e1c072 + e8a2a57 commit e5d967d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
5555
import org.springframework.beans.factory.FactoryBean;
5656
import org.springframework.beans.factory.InitializingBean;
57-
import org.springframework.context.ApplicationEvent;
5857
import org.springframework.context.ApplicationListener;
5958
import org.springframework.context.ConfigurableApplicationContext;
6059
import org.springframework.context.event.ContextRefreshedEvent;
@@ -87,7 +86,7 @@
8786
* @see #setDataSource
8887
*/
8988
public class SqlSessionFactoryBean
90-
implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ApplicationEvent> {
89+
implements FactoryBean<SqlSessionFactory>, InitializingBean, ApplicationListener<ContextRefreshedEvent> {
9190

9291
private static final Logger LOGGER = LoggerFactory.getLogger(SqlSessionFactoryBean.class);
9392

@@ -658,8 +657,8 @@ public boolean isSingleton() {
658657
* {@inheritDoc}
659658
*/
660659
@Override
661-
public void onApplicationEvent(ApplicationEvent event) {
662-
if (failFast && event instanceof ContextRefreshedEvent) {
660+
public void onApplicationEvent(ContextRefreshedEvent event) {
661+
if (failFast) {
663662
// fail-fast -> check all statements are completed
664663
this.sqlSessionFactory.getConfiguration().getMappedStatementNames();
665664
}

0 commit comments

Comments
 (0)