hi everyone, i am using spring from scala and i am facing a problem when trying to inject a service with a trait/superclass.
This is my code:
trait MyServiceHolder{
var myService:MyService = null
@Autowired
def setMyService(ms:MyService) = myService = ms
}
@RunWith(classOf[SpringJUnit4ClassRunner])
@ContextConfiguration(Array("file:src/main/webapp/WEB-INF/application-context.xml"))
class MyConcreteClass extends MyServiceHolder{
def hello() = myService.hello()
}
This works:
@RunWith(classOf[SpringJUnit4ClassRunner])
@ContextConfiguration(Array("file:src/main/webapp/WEB-INF/application-context.xml"))
class MyConcreteClass{
var myService:MyService = null
@Autowired
def setMyService(ms:MyService) = myService = ms
def hello() = myService.hello()
}
The problem is that myService is null in my testcases. When looking at the bytecode level (class file) all annotations are present. Any Ideas?