<?xml version="1.0" encoding="UTF-8"?>
<!--

    The contents of this file are subject to the license and copyright
    detailed in the LICENSE and NOTICE files at the root of the source
    tree and available online at

    http://www.dspace.org/license/

-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <!-- Place all DSpace core service bean definitions below here -->

    <!-- PROPERTY PLACEHOLDER SETUP -->
    <!-- Configure a custom PropertySourcesPlaceholderConfigurer to use our DSpaceConfigurationService. This allows us
         resolve ${...} placeholders in both Bean definitions property values (e.g. within Spring XML config files)
         and in @Value annotations using our DSpaceConfigurationService. These are resolved at runtime. -->
    <bean id="dspaceConfigurationFactoryBean" class="org.dspace.servicemanager.config.DSpaceConfigurationPlaceholderConfigurer">
        <constructor-arg>
          <ref bean="dspaceConfiguration" />
        </constructor-arg>
    </bean>
    <!-- This wires up our ConfigurationService.getConfiguration() method to be called to provide its properties
         to the above PropertySourcesPlaceholderConfigurer bean. -->
    <bean id="dspaceConfiguration" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject" ref="org.dspace.services.ConfigurationService" />
        <property name="targetMethod" value="getConfiguration" />
    </bean>
    <!-- end PROPERTY PLACEHOLDER SETUP-->

    <!-- REQUEST - request service (implemented as a single bean) -->
    <bean id="org.dspace.services.RequestService" class="org.dspace.services.sessions.StatelessRequestServiceImpl"/>
    <!-- REQUEST end beans -->

    <!-- EVENTS -->
    <bean id="org.dspace.services.EventService" class="org.dspace.services.events.SystemEventService"/>

    <!-- EMAIL -->
    <bean id="org.dspace.services.email.EmailServiceImpl"
          class="org.dspace.services.email.EmailServiceImpl">
        <property name="cfg"
                  ref="org.dspace.services.ConfigurationService"/>
    </bean>

    <!-- DSpaceServicesFactory (for easy access to above core services) -->
    <bean id="dSpaceServicesFactory" class="org.dspace.services.factory.DSpaceServicesFactoryImpl"/>

</beans>
