我使用Scala的2.9.1斯卡拉2.9桥法
我的测井特征这样:
trait Logging {
def debug(msg: String, throwables: Throwable*) = ....
....
}
而且我有一个JMSPublisher类混合,在记录特质:
class JMSPublisher extends Publisher with Logging {
def publishProducts(list: List[_ <: Product]) = ....
def publish(list: Seq[Product]) = ....
}
这一切都编译好。我的问题是我有一个用户想要将我的JMSPublisher加载到Spring中。他使用Spring 2.5.6。
当ApplicationContext在启动过程中被加载时,该应用程序崩溃并带有IllegalStateException,抱怨说它无法找到与我的Logging特征相关的桥接方法。
Initialization of bean failed; nested exception is java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public void com.app.messaging.JmsPublisher.debug(java.lang.String, scala.collection.Seq)'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
.....stack trace follows.......
此代码在Scala-2.8下工作,我听说Scala标记的特征有一些在2.9中桥接的方法。我认为这是导致Spring失败的原因。如果我的类不能被Spring加载,我无法升级到Scala-2.9。
有没有人遇到过这个问题?是否有任何修复或解决方法?
我想我们得到了类似的东西 - 幸运的是它不影响我们的实际应用程序,只是Spring IDE标记了一些错误的bean,因为它抱怨说某些特征定义的方法不存在。 – Nick
看到这个:http://stackoverflow.com/questions/8748625/why-are-concrete-function-implementations-in-traits-compiled-to-bridge-methods-i – Janx