Re: Tuscany与Spring MVC 集成

180 views
Skip to first unread message

keller li

unread,
Aug 27, 2012, 3:58:47 AM8/27/12
to Tuscany SCA 中文论坛
你好:
谢谢你的答复,我现在适用的tuscany2.x ,不知道能不能详细讲解一下重新 initStrategies 不知道怎么去调用
sca的bean。

On Jul 18, 9:01 am, zgxzowen <baibing5...@gmail.com> wrote:
> 默认情况下,spring是不会加载sca定义的bean,如果需要则从新定义 org.springframework.web.servlet.DispatcherServlet,重写一个,放到这个包路径下,例如叫
> org.springframework.web.servlet.DispatcherServletXXX ,在这里面有个initStrategies方法,可以在里面定一个扫描
> SCA的bean的方法,通过反射,取得你要扫描包下的 class集合,扫描每个class的
> annoation,如果是sca的标记,查找set方法,然后通过ComponentContext加入到spring管理的上下文环境中,这样就能取得这个 bean的定义了。
>
>
>
>
>
>
>
> On Tuesday, July 10, 2012 3:49:38 PM UTC+8, keller li wrote:
>
> > 大家好:
> > 现在遇到一个Tuscany与Spring
> > MVC整合的问题,在Spring中的Controller中无法获取Tuscany配置spring文件中的bean,看了一下问题好像是不是在同一个app licationcontext中,不知道有人遇到过这个问题怎么解决的吗?

keller li

unread,
Aug 27, 2012, 9:53:50 AM8/27/12
to Tuscany SCA 中文论坛
你好:
今天看了看DispatcherServlet实现有个疑问就是tuscany的spring bean中间会有tuscany的资源调用
这块需要怎么进行维护呢?否则加载后也是空指针。

Raymond Feng

unread,
Aug 28, 2012, 10:53:38 AM8/28/12
to tuscany-s...@googlegroups.com
You can use org.apache.tuscany.sca.host.webapp.spring.TuscanyDispatcherServlet. This class starts both Spring MVC and Tuscany node at the servlet level.

To reference Tuscany services, you can either SCAClientFactory api to locate the Tuscany service or use Tuscany implementation.spring component and define sca:reference for a Spring bean property so that Tuscany can inject the proxy into Spring.
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“Tuscany SCA 中文论坛”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 tuscany-s...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 tuscany-sca-chi...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/tuscany-sca-chinese?hl=zh-CN 访问此网上论坛。
>

Reply all
Reply to author
Forward
0 new messages