<commit_before>package se.citerus.dddsample.config;

import com.pathfinder.api.GraphTraversalService;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.PlatformTransactionManager;
import se.citerus.dddsample.application.ApplicationEvents;
import se.citerus.dddsample.application.BookingService;
import se.citerus.dddsample.application.CargoInspectionService;
import se.citerus.dddsample.application.HandlingEventService;
import se.citerus.dddsample.application.impl.BookingServiceImpl;
import se.citerus.dddsample.application.impl.CargoInspectionServiceImpl;
import se.citerus.dddsample.application.impl.HandlingEventServiceImpl;
import se.citerus.dddsample.application.util.SampleDataGenerator;
import se.citerus.dddsample.domain.model.cargo.CargoRepository;
import se.citerus.dddsample.domain.model.handling.HandlingEventFactory;
import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
import se.citerus.dddsample.domain.model.location.LocationRepository;
import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
import se.citerus.dddsample.domain.service.RoutingService;
import se.citerus.dddsample.infrastructure.routing.ExternalRoutingService;

@Configuration
@ImportResource({
        "classpath:context-interfaces.xml",
        "classpath:context-infrastructure-messaging.xml",
        "classpath:context-infrastructure-persistence.xml"})
public class DDDSampleApplicationContext {

    @Autowired
    CargoRepository cargoRepository;

    @Autowired
    LocationRepository locationRepository;

    @Autowired
    VoyageRepository voyageRepository;

    @Autowired
    RoutingService routingService;

    @Autowired
    HandlingEventRepository handlingEventRepository;

    @Autowired
    HandlingEventFactory handlingEventFactory;

    @Autowired
    ApplicationEvents applicationEvents;

    @Autowired
    GraphTraversalService graphTraversalService;

    @Autowired
    PlatformTransactionManager platformTransactionManager;

    @Autowired
    SessionFactory sessionFactory;

    @Bean
    public BookingService bookingService() {
        return new BookingServiceImpl(cargoRepository, locationRepository, routingService);
    }

    @Bean
    public CargoInspectionService cargoInspectionService() {
        return new CargoInspectionServiceImpl(applicationEvents, cargoRepository, handlingEventRepository);
    }

    @Bean
    public HandlingEventService handlingEventService() {
        return new HandlingEventServiceImpl(handlingEventRepository, applicationEvents, handlingEventFactory);
    }

    @Bean
    public HandlingEventFactory handlingEventFactory() {
        return new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);
    }

    @Bean
    public RoutingService routingService() {
        ExternalRoutingService routingService = new ExternalRoutingService();
        routingService.setGraphTraversalService(graphTraversalService);<commit_msg>Fix bean init order.<commit_after>package se.citerus.dddsample.config;

import com.pathfinder.api.GraphTraversalService;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.PlatformTransactionManager;
import se.citerus.dddsample.application.ApplicationEvents;
import se.citerus.dddsample.application.BookingService;
import se.citerus.dddsample.application.CargoInspectionService;
import se.citerus.dddsample.application.HandlingEventService;
import se.citerus.dddsample.application.impl.BookingServiceImpl;
import se.citerus.dddsample.application.impl.CargoInspectionServiceImpl;
import se.citerus.dddsample.application.impl.HandlingEventServiceImpl;
import se.citerus.dddsample.application.util.SampleDataGenerator;
import se.citerus.dddsample.domain.model.cargo.CargoRepository;
import se.citerus.dddsample.domain.model.handling.HandlingEventFactory;
import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
import se.citerus.dddsample.domain.model.location.LocationRepository;
import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
import se.citerus.dddsample.domain.service.RoutingService;
import se.citerus.dddsample.infrastructure.routing.ExternalRoutingService;

@Configuration
@ImportResource({
        "classpath:context-interfaces.xml",
        "classpath:context-infrastructure-messaging.xml",
        "classpath:context-infrastructure-persistence.xml"})
public class DDDSampleApplicationContext {

    @Autowired
    CargoRepository cargoRepository;

    @Autowired
    LocationRepository locationRepository;

    @Autowired
    VoyageRepository voyageRepository;

    @Autowired
    GraphTraversalService graphTraversalService;

    @Autowired
    RoutingService routingService;

    @Autowired
    HandlingEventFactory handlingEventFactory;

    @Autowired
    HandlingEventRepository handlingEventRepository;

    @Autowired
    ApplicationEvents applicationEvents;

    @Autowired
    PlatformTransactionManager platformTransactionManager;

    @Autowired
    SessionFactory sessionFactory;

    @Bean
    public BookingService bookingService() {
        return new BookingServiceImpl(cargoRepository, locationRepository, routingService);
    }

    @Bean
    public CargoInspectionService cargoInspectionService() {
        return new CargoInspectionServiceImpl(applicationEvents, cargoRepository, handlingEventRepository);
    }

    @Bean
    public HandlingEventService handlingEventService() {
        return new HandlingEventServiceImpl(handlingEventRepository, applicationEvents, handlingEventFactory);
    }

    @Bean
    public HandlingEventFactory handlingEventFactory() {
        return new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);
    }

    @Bean
    public RoutingService routingService() {
        ExternalRoutingService routingService = new ExternalRoutingService();
        routingService.setGraphTraversalService(graphTraversalService);
{'fraction_non_alphanumeric': 0.0715291907966818, 'fraction_numerical': 0.0, 'mean_word_length': 5.663190823774765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1465973', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1691, 'n_words': 260}