How do I inject a Spring bean into Apache Wink?

[亡魂溺海] 提交于 2019-12-11 09:08:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!