因为最近有个项目要用到ehcache提高访问效率,所以特地到网上找了spring3.1+ehcache整合的代码,但是整合过程一直报错:
1.the prefix "cache" for element "cache:annotation-driven" is not bound!
2.Error creating bean with name 'sessionFactory'
3Initial cause was Invalid byte 2 of 2-byte UTF-8 sequence
第1个错误:在整合的时候要加上
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-3.2.xsd"
第2和3的错误:
后来在网上看到第2个错误的原因竟然是因为:ehcache.xml中有中文注释!!!!
至此,所有问题都解决了。