spring @Autowire with scala 2.8
When I do:
class XX {
@Autowired var jdbcTemplate : SimpleJdbcTemplate = null
}
The code compiles fine but blows up when I start the webapp. It giv开发者_如何学Goes:
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: scala/collection/immutable/List
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getDeclaredConstructors(Class.java:1836)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)
How do I fix this? Btw I get the same error when I try to @Autowire the constructor.
Make sure that version of Scala runtime library in your runtime environment matches version of Scala compiler. Currently it looks like your code was compiled against Scala 2.8.x API, but runtime environment uses Scala 2.7.x.
精彩评论