I am using spring from scala and I ran into a problem when trying to enter a service using the attribute / 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() }
It 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 test files. When viewing the bytecode level (class file), all annotations are present. Any ideas?
source share