mybatis / spring

Spring integration for MyBatis 3
Apache License 2.0
2.82k stars 2.6k forks source link

The latest springboot using mybatis-spring-stater 3.0.2 throw exception "Invalid value type for attribute 'factoryBeanObjectType': java.lang.String" #855

Closed aalx closed 12 months ago

aalx commented 1 year ago

Springboot Version 3.2.0-M2,spring-boot-starter 3.0.2 In this version ,FactoryBeanRegistrySupport.getTypeForFactoryBeanFromAttributes() method has been changed,throw a IllegalArgumentException when "factoryBeanObjectType" not ResolvableType、Class type。But in ClassPathMapperScanner.processBeanDefinitions() menthod ( line 277) set a String type with beanClassName,

harawata commented 1 year ago

Hello @aalx ,

Could you share a small project that reproduces the exception? There is a project template for mybatis-spring-boot in this repo.

Also, please post a link to the relevant commit (or issue) in the Spring repo if you can. I would like to understand the details about the change.

StreamLuna commented 1 year ago

I had the same problem when I wanted to use spring-boot 3.2.0-M2 and mybatis-spring-boot-starter 3.0.2, spring-boot 3.2.0-M2 depends on spring-beans 6.1.0-M4. Changing the spring.version in pom.xml file to <spring.version>6.1.0-M4</spring.version> and then running the test can reproduce the problem. It throws an exception when running into ResolvableType getTypeForFactoryBeanFromAttributes(AttributeAccessor attributes) method. I don't know much about mybatis-spring, maybe it can be fixed when the spring-beans 6.1 is released.

harawata commented 1 year ago

The doc states that mybatis-spring-boot-starter 3.0 is not compatible with spring-boot 3.2, so @kazuki43zoo is aware of the issue probably. https://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/#requirements

kazuki43zoo commented 12 months ago

@aalx @StreamLuna (cc: @harawata ) Thanks for your feedback! I'll fix this issue ASAP.

kazuki43zoo commented 11 months ago

@aalx @StreamLuna I've fixed via #865. Please try 3.0.3-SNAPSHOT! and we will release 3.0.3 as GA version ASAP.

techwn commented 10 months ago

I noticed that spring boot 3.2 GA is published, I think the 3.0.3 GA should be scheduled.