问题
How do I inject Spring-managed beans into Apache Wink?
I have a wink application started in web.xml
that starts fine if I stub out a dummy data service @Autowired
under an interface within it. I have implemented a JPA service to provide the data implementing the same interface, set up via Spring 2.5.6. This works fine in isolation too.
I think I just need to inject my JPA service instead of my dummy service, but I can't figure out how to do that - tried @Service
annotations and <context:annotation-driven>
; tried manually injecting the JPA service. It's like Wink and Spring aren't aware of each other.
The Wink docs do mention a Spring integration , however this talks about an "Apache Wink core context file" which I can't find mention of elsewhere in the Wink docs.
Anyone got any ideas?
回答1:
The "Apache Wink core context file" wink-core-context.xml
is a Spring configuration file.
It is part of "wink-spring-support".
You can find the file within apache-wink-1.1.3-incubating-src.zip
in apache-wink-1.1.3-incubating-src\wink-spring-support\src\main\resources\META-INF\server
来源:https://stackoverflow.com/questions/9180584/how-do-i-inject-a-spring-bean-into-apache-wink