Optimizing MyBatis Load Time with Spring Boot

Optimizing MyBatis Load Time with Spring Boot

When working with Spring Boot and MyBatis, I encountered a delay in loading that resulted in the following error:

org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl

To resolve this issue, I needed to adjust the configuration settings to prevent an exception caused by the BeanSerializer. The error message indicated that no properties were discovered to create the BeanSerializer, prompting me to disable the FAIL_ON_EMPTY_BEANS feature.

Solution: Disable Serialization Feature

To fix this issue, I added the following configuration to the yml file:

spring:
  jackson:
    serialization:
      FAIL_ON_EMPTY_BEANS: false

Similarly, I also set the same configuration in the properties file:

spring.jackson.serialization.FAIL_ON_EMPTY_BEANS = false

Some users have suggested that changing the bean property from private to public can resolve the issue. However, I have not tried this approach and do not recommend it as a solution.

Background

This article was written in collaboration with Tencent Cloud’s media-sharing plan. If you are reading this article, you are welcome to join and share your thoughts together.

Published Date

This article was published on September 10, 2018, at 12:44:54 PM.

Related Technologies

The article involves the following technologies:

  • Apache Javassist
  • Spring
  • MyBatis
  • Jackson serialization

Sharing Options

You can share this article with your friends and colleagues using the following options:

  • Share the article to a circle of friends
  • Share articles to QQ
  • Share article on Twitter
  • Copy the link to the article to clipboard
  • Scan QR code
  • Community concerns cloud scan code + Tencent cloud receive vouchers