<commit_before>package pl.openrest.dto.config;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.rest.core.UriToEntityConverter;
import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.util.AnnotatedTypeScanner;
import org.springframework.http.converter.HttpMessageConverter;

import pl.openrest.core.config.OpenRestConfigurer;
import pl.openrest.dto.annotations.Dto;
import pl.openrest.dto.event.AnnotatedDtoEventHandlerBeanPostProcessor;
import pl.openrest.dto.mapper.BeforeCreateMappingHandler;
import pl.openrest.dto.mapper.BeforeUpdateMappingHandler;
import pl.openrest.dto.mapper.DefaultCreateAndUpdateMapper;
import pl.openrest.dto.mapper.MapperDelegator;
import pl.openrest.dto.mapper.MapperFactory;
import pl.openrest.dto.mapper.MappingManager;
import pl.openrest.dto.registry.DtoInformation;
import pl.openrest.dto.registry.DtoInformationRegistry;
import pl.openrest.dto.spel.evaluation.SpelEvaluatorBean;
import pl.openrest.dto.webmvc.NonDtoRequestsFilter;
import pl.openrest.dto.webmvc.json.DtoAwareDeserializerModifier;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

@Configuration
public class OpenRestDtoConfiguration {

    // @Autowired
    // private RootResourceInformationHandlerMethodArgumentResolver rootResourceResolver;
    //
    // @Autowired
    // private BackendIdHandlerMethodArgumentResolver backendIdResolver;

    @Autowired
    private Repositories repositories;
    @Autowired
    private List<HttpMessageConverter<?>> defaultMessageConverters;

    @Bean
    public DtoInformationRegistry dtoInformationRegistry() {
        Set<String> packagesToScan = new HashSet<String>();

        for (Class<?> domainType : repositories) {
            packagesToScan.add(domainType.getPackage().getName());
        }
        DtoInformationRegistry registry = new DtoInformationRegistry();
        Set<Class<?>> candidates = new AnnotatedTypeScanner(Dto.class).findTypes("packagesToScan");
        for (Class<?> dtoClass : candidates) {<commit_msg>Repair  package scanning for dto classes<commit_after>package pl.openrest.dto.config;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.rest.core.UriToEntityConverter;
import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.util.AnnotatedTypeScanner;
import org.springframework.http.converter.HttpMessageConverter;

import pl.openrest.core.config.OpenRestConfigurer;
import pl.openrest.dto.annotations.Dto;
import pl.openrest.dto.event.AnnotatedDtoEventHandlerBeanPostProcessor;
import pl.openrest.dto.mapper.BeforeCreateMappingHandler;
import pl.openrest.dto.mapper.BeforeUpdateMappingHandler;
import pl.openrest.dto.mapper.DefaultCreateAndUpdateMapper;
import pl.openrest.dto.mapper.MapperDelegator;
import pl.openrest.dto.mapper.MapperFactory;
import pl.openrest.dto.mapper.MappingManager;
import pl.openrest.dto.registry.DtoInformation;
import pl.openrest.dto.registry.DtoInformationRegistry;
import pl.openrest.dto.spel.evaluation.SpelEvaluatorBean;
import pl.openrest.dto.webmvc.NonDtoRequestsFilter;
import pl.openrest.dto.webmvc.json.DtoAwareDeserializerModifier;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

@Configuration
public class OpenRestDtoConfiguration {

    // @Autowired
    // private RootResourceInformationHandlerMethodArgumentResolver rootResourceResolver;
    //
    // @Autowired
    // private BackendIdHandlerMethodArgumentResolver backendIdResolver;

    @Autowired
    private Repositories repositories;
    @Autowired
    private List<HttpMessageConverter<?>> defaultMessageConverters;

    @Bean
    public DtoInformationRegistry dtoInformationRegistry() {
        Set<String> packagesToScan = new HashSet<String>();

        for (Class<?> domainType : repositories) {
            packagesToScan.add(domainType.getPackage().getName());
        }
        DtoInformationRegistry registry = new DtoInformationRegistry();
        Set<Class<?>> candidates = new AnnotatedTypeScanner(Dto.class).findTypes(packagesToScan);
        for (Class<?> dtoClass : candidates) {
{'fraction_non_alphanumeric': 0.09351037965214139, 'fraction_numerical': 0.0, 'mean_word_length': 5.847631241997439, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6723540', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1504, 'n_words': 227}