mybatis / spring-boot-starter

MyBatis integration with Spring Boot
Apache License 2.0
4.12k stars 1.79k forks source link

The MapperScannerConfigurer should support FactoryBeans #964

Open missfmaster opened 4 months ago

missfmaster commented 4 months ago

in MapperScannerConfigurer.java:

private String getPropertyValue(String propertyName, PropertyValues values) {
    PropertyValue property = values.getPropertyValue(propertyName);

    if (property == null) {
      return null;
    }

    Object value = property.getValue();

    if (value == null) {
      return null;
    } else if (value instanceof String) {
      return value.toString();
    } else if (value instanceof TypedStringValue) {
      return ((TypedStringValue) value).getValue();
    } else {
      return null;
    }
  }

but my value is RuntimeBeanReference ( implements FactoryBean ), be set:

builder.addPropertyReference("basePackage", basePackageBeanName);

so, value is null and get java.lang.IllegalArgumentException: At least one base package must be specified.

missfmaster commented 4 months ago

the version is mybatis-spring-3.0.3