是在Tomcat's context.xml,还是在persistence.xml,还是在spring-servlet.xml里?哪种方式比较好?
另外controller里调用service,是不是用@AutoWired注解就可以,service里用@Service,@Transactional注解.是否需要如下配置:
[code="java"]
<!-- 配置切面 -->
aop:config
/aop:config
<!-- 配制具体方法及事务参数 -->
tx:attributes
/tx:attributes
/tx:advice [/code]
比较优雅的方式是什么样比较好?
SpringMVC+JPA2(Hibernate),数据源配置在哪比较好?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- linvar 2011-01-27 10:20关注
"数据源、事务等配置能否统一放在spring-servlet.xml里,而完全不用spring-config.xml,Spring的配置内容多,不好弄啊"
你的spring-servlet.xml是指springmvc的配置吗
我是在主配置文件(spring-config.xml)配置事务, mybatis, auto_wired
数据源在spring-datasource.xml中,由spring-config.xml import进来
springmvc.xml配置spring MVC相关的内容,
我感觉很优雅,很清晰本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报