<?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:mvc="http://www.springframework.org/schema/mvc"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

	<!-- Activate annotation configured components -->
	<task:annotation-driven/>
	<context:annotation-config/>
	<context:component-scan base-package="com.highcharts.export.converter" />

	<context:property-placeholder location="classpath*:app-convert.properties" order="0"/>
	<!-- If there is a file in the following location then it has the highest precedence and ignore the above settings --> 
	<context:property-placeholder ignore-unresolvable="true" ignore-resource-not-found="true" location="WEB-INF/spring/app-convert.properties" order="-1"/>

	<bean id="tempDir" class="com.highcharts.export.util.TempDir"/>

	<bean id="serverObjectFactory" class="com.highcharts.export.pool.ServerObjectFactory" depends-on="tempDir">
		<property name="host" value="${host}"/>
		<property name="basePort" value="${port}"/>
		<property name="exec" value="${exec}"/>
		<property name="script" value="${script}"/>
		<property name="readTimeout" value="${readTimeout}"/>
		<property name="connectTimeout" value="${connectTimeout}"/>
		<property name="maxTimeout" value="${maxTimeout}"/>
	</bean>

	<bean id="serverPool" class="com.highcharts.export.pool.BlockingQueuePool">
		<constructor-arg name="factory" ref="serverObjectFactory"/>
		<constructor-arg name="number"  value="${poolSize}"/>
		<constructor-arg name="maxWait" value="${maxWait}"/>
		<constructor-arg name="retentionTime" value="${retentionTime}"/>
	</bean>

</beans>
