<bean>
<!-- 设置为true以忽略对Accept Header的支持 -->
<property value="1" />
<property>
<bean>
<constructor-arg>
<bean>
<constructor-arg>
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</property>
<property value="true" />
<!-- 在没有扩展名时即: "/user/getUser" 时的默认展现形式 -->
<property value="text/html" />
<!-- 用于开启 /user/getUser?format=json 的支持 -->
<property value="true" />
<property>
<list>
<!-- for application/json -->
<bean>
</bean>
</list>
</property>
</bean>
</beans>
viewResolver和velocityConfig节点指定了spring mv返回页面用velocity。
Ibatis配置
带读写分离的数据源配置
<?xml version="1.0" encoding="GBK"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
"
default-autowire="byName">
<bean>
<property value="${chat.jdbc.driver}"/>
<property value="${chat.jdbc.url}"/>
<property value="${chat.jdbc.username}"/>
<property value="${chat.jdbc.password}"/>
<property value="${chat.jdbc.maxActive}"/>
<!-- sql 心跳 -->
<property value="true"/>
<property value="false"/>
<property value="false"/>
<property value="select 1"/>
<property value="1"/>
<property value="60000"/>
<property value="${chat.jdbc.maxActive}"/>
</bean>
<bean
>
<property value="${select.chat.jdbc.driver}"/>
<property value="${select.chat.jdbc.url}"/>
<property value="${select.chat.jdbc.username}"/>
<property value="${select.chat.jdbc.password}"/>
<property value="${select.chat.jdbc.maxActive}"/>
<!-- sql 心跳 -->
<property value="true"/>
<property value="false"/>
<property value="false"/>
<property value="select 1"/>
<property value="1"/>
<property value="60000"/>
<property value="${select.chat.jdbc.maxActive}"/>
</bean>
<bean>
<property>
<list>
<value>classpath:sqlmap-config.xml</value>
</list>
</property>
<property ref="dataSource"/>
</bean>
<bean>
<property>
<list>
<value>classpath:sqlmap-config.xml</value>
</list>
</property>
<property ref="selectedDataSource"/>
</bean>
<bean>
<property ref="sqlMapClientRead"/>
</bean>
<bean>
<property ref="sqlMapClient"/>
</bean>
<bean
>
<property ref="dataSource"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>