WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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