<?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:mvc="http://www.springframework.org/schema/mvc"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns:context="http://www.springframework.org/schema/context" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.4.xsd">
         
       <context:annotation-config /> 
       <context:component-scan base-package="org.artgasmator" />  
       
       <security:global-method-security pre-post-annotations="enabled" />
       
      
       <!-- Property Configurator -->
	   <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	   		<property name="locations">
	   			<list>
	   				<value>/WEB-INF/config.properties</value>
	   			</list>
	   		</property>
	   </bean> 
	   <!-- End Property Configurator -->  
         
	   <!--  MVC -->
	   <mvc:annotation-driven/>	
	   
	   <mvc:resources location="/css/" mapping="/css/**"/>
	   <mvc:resources location="/js/" mapping="/js/**"/>
	   <mvc:resources location="/images/" mapping="/images/**"/>
	   <mvc:resources location="/swf/" mapping="/swf/**"/>
	   
	   
	   <mvc:default-servlet-handler/>
	   
	   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        	<property name="prefix" value="/WEB-INF/includes/"/>
        	<property name="suffix" value=".jsp"/>
       </bean>
       
       <bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
       		<property name="order" value="1"/>
       		<property name="basename" value="views" />
	   </bean>
	   
	   <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
	   </bean>
	   
	   <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
	   
	   <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		  <property name="messageConverters">
			  <list>
			    <ref bean="jacksonMessageConverter"/>
			  </list>
		  </property>
	   </bean>
       <!-- End MVC -->	
	   
	   
	   <!-- Data -->
	   <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
			destroy-method="close">
			<property name="driverClassName" value="${jdbc.driver.class.name}"></property>
			<property name="url" value="${jdbc.url}"></property>
			<property name="username" value="${jdbc.username}"></property>
			<property name="password" value="${jdbc.password}"></property>
	   </bean>
	   
	   <bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"></bean>
	    
	   <bean id="abstractDao" class="org.artgasmator.data.dao.impl.AbstractDao" 
	   		abstract="true">
	   		<property name="dataSource" ref="dataSource"></property>
	   </bean>
	   
	   <bean id="albumGenreDao" class="org.artgasmator.data.dao.impl.AlbumGenreDaoImpl"
	   		parent="abstractDao">
	   </bean>
	   
	   <bean id="artistDao" class="org.artgasmator.data.dao.impl.ArtistDaoImpl"
	   		parent="abstractDao" init-method="init">
	   		<property name="artistLabelDao" ref="artistLabelDao"></property>
	   </bean>
	   
	   <bean id="artistLabelDao" class="org.artgasmator.data.dao.impl.ArtistLabelDaoImpl"
	   		parent="abstractDao">
	   </bean>
	   
	   <bean id="memberDao" class="org.artgasmator.data.dao.impl.MemberDaoImpl"
	   		parent="abstractDao" init-method="init">
	   		<constructor-arg index="0" ref="lobHandler"></constructor-arg>
	   </bean>          	
	   <!-- End Data -->
	   
	   
	   <!-- Service -->
	   <bean id="albumGenreService" class="org.artgasmator.service.impl.AlbumGenreServiceImpl">
	   		<property name="albumGenreDao" ref="albumGenreDao"></property>
	   </bean>
	   
	   <bean id="artistService" class="org.artgasmator.service.impl.ArtistServiceImpl">
	   		<property name="artistDao" ref="artistDao"></property>
	   </bean>
	   
	   <bean id="artistLabelService" class="org.artgasmator.service.impl.ArtistLabelServiceImpl">
	   		<property name="artistLabelDao" ref="artistLabelDao"></property>
	   </bean>
	   
	   <bean id="memberService" class="org.artgasmator.service.impl.MemberServiceImpl">
	   		<property name="memberDao" ref="memberDao"></property>
	   </bean>          
	   <!-- End Service --> 
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
		
</beans>