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

<!--
========================================================================================================================
beans-jcr.xml

Copyright (c) 2013 Manning Publications Co.

Willie Wheeler (willie.wheeler@gmail.com)

Book: http://manning.com/wheeler/
Blog: http://springinpractice.com/
Code: https://github.com/springinpractice
========================================================================================================================
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jackrabbit="http://springmodules.dev.java.net/schema/jcr/jackrabbit"
	xmlns:jcr="http://springmodules.dev.java.net/schema/jcr"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:tx="http://www.springframework.org/schema/tx"
	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-3.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
		http://springmodules.dev.java.net/schema/jcr
		http://springinpractice.s3.amazonaws.com/schema/jcr/springmodules-jcr.xsd
		http://springmodules.dev.java.net/schema/jcr/jackrabbit
		http://springinpractice.s3.amazonaws.com/schema/jcr/springmodules-jackrabbit.xsd">
	
	<context:property-placeholder location="classpath:/spring/environment.properties" />
	
	<jackrabbit:repository id="repository" homeDir="${repository.dir}" configuration="${repository.conf}" />
	
	<bean id="credentials" class="javax.jcr.SimpleCredentials">
		<constructor-arg value="dummy" />
		<constructor-arg value="dummy" />
	</bean>
			
	<jcr:sessionFactory id="sessionFactory" repository="repository" credentials="credentials" />
	
	<context:component-scan base-package="com.springinpractice.ch12.dao.jcr" />
	
	<!-- Default ID is "transactionManager" -->
	<jackrabbit:transaction-manager sessionFactory="sessionFactory" />
	
	<tx:annotation-driven />
</beans>
