`

关于spring配置文件配置

阅读更多
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>

<!-- 事务管理器配置 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager" />

<aop:config>
<!--
This definition creates auto-proxy infrastructure based on the given
pointcut, expressed in AspectJ pointcut language. Here: applying the
advice named "txAdvice" to all methods on classes in package and
subpackages.
-->
<aop:advisor pointcut="execution(* com.huawei..service..*.*(..))"
advice-ref="txAdvice" />
</aop:config>

<!--
Transaction advice definition, based on method name patterns. Defaults
to PROPAGATION_REQUIRED for all methods whose name starts with
"insert" or "update", and to PROPAGATION_REQUIRED with read-only hint
for all other methods. transaction-manager="transactionManager"
-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="**" />
</tx:attributes>
</tx:advice>

<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>i18n/common/messages</value>
<value>i18n/system/system</value>
<value>i18n/log/log</value>
<value>i18n/cluster/cluster</value>
<value>i18n/trap/trap</value>
<value>i18n/ware/ware</value>
<value>i18n/unit/unit</value>
<value>i18n/cn/cn</value>
<value>i18n/license/license</value>
</list>
</property>
</bean>
</beans>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics