<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
">

    <!-- Mapping des vues -->
    <bean id="mesVues" class="org.springframework.web.servlet.view.InternalResourceViewResolver">

        <property name="prefix">
            <value>/WEB-INF/views/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

    <bean name="/welcome.htm" class="actions.WelcomeController"/>

    <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">

    </bean>
    <!--
    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
    -->

    <!-- Packages : contrôleurs MVC -->
    <context:component-scan base-package="controllers"/>

    <!-- Support des annotations -->
    <mvc:annotation-driven/>

    <!-- Localisation du site -->
    <!-- Complétez-->

    <!-- Hibernate -->

    <tx:annotation-driven />

    <bean id="dataSourceMySql" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/mysql"/>
        <property name="username" value="root"/>
        <property name="password" value="XXX"/>
    </bean>

    <bean id="dataSourceOracle" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
        <property name="username" value="SYSTEM"/>
        <property name="password" value="XXX"/>
    </bean>


    <!-- À faire -->

    <bean id="userDao" class="dao.EtudiantDaoImpl">
        <constructor-arg>
            <ref bean="mySessionFactory" />
        </constructor-arg>
    </bean>

    <!-- Alternativement, déclarer cet attribut @Autowired
    <bean id="etudiantController" class="controllers.EtudiantController">
        <property name="etudiantDao" ref="userDao" />
    </bean>
    -->


</beans>

