Skip to content

Conversation

290044632
Copy link

[description]

1.Add the beanNameGenerator property to the MybatisProperties class for customizing the name generator class of the Mapper bean.

[Test Code]

    @Test
    void withCustomBeanNameGenerator() {
        contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, CustomBeanNameGeneratorConfiguration.class)
                .withPropertyValues("mybatis.beanNameGenerator:org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator")
                .run((context) -> {
                    assertThat(context.containsBean(com.example.mapper.two.DateTimeMapper.class.getName())).isTrue();
                    assertThat(context.containsBean(com.example.mapper.one.DateTimeMapper.class.getName())).isTrue();
                });
    }

    @Configuration
    @TestAutoConfigurationPackage(DateTimeMapper.class)
    static class CustomBeanNameGeneratorConfiguration {

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant