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

    <!-- Tool -->
    <bean class="me.chyxion.tigon.codegen.service.CodeGenBaseTool" />

    <!--Services -->
    <bean class="me.chyxion.tigon.codegen.service.support.CodeGenServiceSupport" />
    <bean class="me.chyxion.tigon.codegen.service.support.ControllerCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.ControllerTestCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.MapperCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.MapperTestCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.MapperXmlCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.ModelCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.ServiceCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.TableCodeGen" />
    <bean class="me.chyxion.tigon.codegen.service.support.ViewCodeGen" />

    <!-- FreeMarker Config -->
    <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"
          p:templateLoaderPaths="/WEB-INF/views/, classpath:/, classpath:/webapp/views/"
          p:defaultEncoding="utf-8"
          p:preferFileSystemAccess="false">
        <property name="freemarkerSettings">
            <props>
                <prop key="template_update_delay">${tigon.codegen.freemarker.cache.expire:36000}</prop>
                <prop key="output_encoding">utf-8</prop>
                <prop key="locale">en_US</prop>
                <prop key="date_format">yyyy-MM-dd</prop>
                <prop key="time_format">HH:mm:ss</prop>
                <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
                <!-- avoid 000.00 -->
                <prop key="number_format">#</prop>
            </props>
        </property>
    </bean>
    <bean class="me.chyxion.tigon.codegen.freemarker.FreeMarkerViewResolverExt"
          p:suffix=".ftl"
          p:contentType="text/html; charset=utf-8"
          p:exposeRequestAttributes="true"
          p:order="16"
    />

    <bean class="org.springframework.jdbc.core.JdbcTemplate">
        <constructor-arg>
            <bean class="com.alibaba.druid.pool.DruidDataSource"
                  init-method="init"
                  destroy-method="close"
                  p:url="jdbc:mysql://${datasource.host}:${datasource.port}/${datasource.database-name}?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull"
                  p:username="${datasource.username}"
                  p:password="${datasource.password}"
            />
        </constructor-arg>
    </bean>
</beans>
