SpringMVC+JPA2(Hibernate),数据源配置在哪比较好?

是在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]
比较优雅的方式是什么样比较好?

"数据源、事务等配置能否统一放在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相关的内容,
我感觉很优雅,很清晰

不错的优雅.
数据源一般我配在spring-config.xml,也就是spring的主配置文件里
"controller里调用service,是不是用@AutoWired注解就可以,service里用@Service,@Transactional注解"
正解.
我就是这样做的
不过还要在spring-config.xml里加上自动扫描基础包, 这样@autowired才有效

/context:component-scan

相应的springmvc的配置也要加上

/context:component-scan
这样才会扫描@controller注释

数据源我单配了一个文件,applicationContext-datasource.xml
因为涉及多数据源、分布式事务等等情况,所以这样折腾的。