class I18nConfiguration {

    @Bean
    @SneakyThrows
    public MessageSource autoResolveI18nMessageSource() {<FILL_FUNCTION_BODY>}

    @Bean
    @Primary
    public MessageSource compositeMessageSource(ObjectProvider<MessageSource> objectProvider) {
        CompositeMessageSource messageSource = new CompositeMessageSource();
        messageSource.addMessageSources(objectProvider.stream().collect(Collectors.toList()));
        MessageSourceInitializer.init(messageSource);
        return messageSource;
    }


}


        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        messageSource.setDefaultEncoding("UTF-8");
        Resource[] resources = new PathMatchingResourcePatternResolver().getResources("classpath*:i18n/**");

        for (Resource resource : resources) {
            String path = resource.getURL().getPath();
            if (StringUtils.hasText(path) && (path.endsWith(".properties") || path.endsWith(".xml"))) {
                path = path.substring(path.lastIndexOf("i18n"));
                String[] split = path.split("[/|\\\\]");
                String name = split[split.length - 1];
                name = name.contains("_") ? name.substring(0, name.indexOf("_")) : name;
                split[split.length - 1] = name;
                log.info("register i18n message resource {} -> {}", path, name);

                messageSource.addBasenames(String.join("/", split));
            }
        }
        return messageSource;
    
<no_super_class>