Topic: spring项目中Bean的分类和管理方法?哪位有项目经验请交流

  Print this page

1.spring项目中Bean的分类和管理方法?哪位有项目经验请交流 Copy to clipboard
Posted by: 主管
Posted on: 2004-11-08 10:17

spring bean的分类和责任可以按照j2ee pattern的方式分为,

.facade bean 提供client端呼叫api,service的协调者
.service bean 封装biz logic
.business bean 封装 biz object
.dao bean 提供对data store的管理

请问有spring项目经验的朋友和其他j2ee框架的朋友你们如何分类管理你们的object。
另,如何解决sping的单个配置文件管理大量bean的问题。好像Petclinic中有解决方式,还没来的及看

2.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: floater
Posted on: 2004-11-08 10:30

I use component/service approach. It's easier to test, dao has its own xml file(there could be several dao xml files, e.g., one for ibatis-stored procedure, one for ibatis-sql, one for spring jdbc with stored procedures, one for sprind jdbc with sql, etc.
remoting has its own xml files too.

services are grouped by functionality.

We need a better tool to handle this, definitely.

3.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: 主管
Posted on: 2004-11-08 11:37

services可以认为是各use case共用的logic流程的抽象,不知道和grouped by functionality是不是一个说法。
使用很多xml配置是有点烦,工具应该是需要的

谢谢Jedi floater的回答,偶心里有底了,不过偶还是要在项目中衡量使用那么多层次的利弊,提高生产力和可重用性和可测性是我们的目的

4.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: floater
Posted on: 2004-11-08 12:20

I am very glad to see this line: 提高生产力和可重用性和可测性是我们的目的.

In my experience, Spring helps a lot on this line. In Yan's book and others, there are descriptions that this line is guaranteed by some oo principles under certain assumptions. Since Spring doesn't break any of these principles and follows all of them in its control, it helps.

as for "services可以认为是各use case共用的logic流程的抽象,不知道和grouped by functionality是不是一个说法":

services可以认为是各use case共用的logic流程的抽象 - yea, this is my service definition.
grouped by functionality - I mean, say, register user services are related, so they are in one xml file, trading related services are in one xml file, settlement related services are in one xml file(Stock trading has two aspects, one is the actual trading, one is the after trading settlement). We don't want to put these 3 in one xml file, otherwise, it's hard to test each of them.

5.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: 主管
Posted on: 2004-11-08 20:55

嗯,可以肯定Spring框架可以帮助我们达到我们的目的。
现在的问题是如果正确的按照Spring的方式做事,怎样的方式才是正确的方式那?
(或是惯用法)
您在您的项目中是怎样使用spring的。spring有哪些不爽的地方,例如一些小陷阱,需要注意的地方。最好能有个规范或指导文档之类的冬冬,我想如果我们公司真的用spring,我一定会整理出类似的经验或惯用法文档来统一团队。
也就是说可以把spring当作一种语言来理解,他的语义他的惯用法是我们需要关注的。

这个问题变成了两个问题
1.spring框架的使用问题
2.sping bean的管理问题

呵呵,是不是问题太多了,菜鸟

6.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: 主管
Posted on: 2004-11-08 21:40

另偶发现sping可能会存在的问题

1.如果bean够多的话,context的管理维护问题

2.如果bean够多的话,bean之间的依赖关系维护问题

很明显,需要有效的工具支持,最好是可视化的。这个星球上是不是有人在思考在做这方面的工作, Jedi floater?

7.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: jeffrey_he
Posted on: 2004-11-09 09:28

工具有一个啊,老早就有了,updatesite。

8.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: floater
Posted on: 2004-11-09 10:44

I am working currently in my working place to push it as the standard framework for the entire company, we just finished phase 1, and on the way to phase 2 and 3. So far, the problems we encountered are not really Spring related, rather other problems, for instance, f*cking IBM can't even get their own udb driver working with their websphere. I use this word to expression my looking down on IBM. Spring itself is just great, I used it on 4 apps, very handy tool.

We wrote a few documents to standardize some common practices too, I wouldn't say 规范, but 指导, guideline, is more appropriate.

as for context的管理维护, bean之间的依赖关系,
beans are in files, so filenames should have proper names.

I do think we need a better tool, I am taking time to investigate it now. Yea, I agree with you in another post that we should have a visual/editable tool, if possible. spring eclipse plugin's graph is not movable.

9.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: 主管
Posted on: 2004-11-09 11:31

more questions
1. May i share your guideline?
2. "beans are in files, so filenames should have proper names. " e.g. pls
3. Why IBM, why not Microsoft? Both big p*ssy Smile

10.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: floater
Posted on: 2004-11-09 22:28

My spring doc is here already, my dao doc will be here too. These two contain more than I wrote for my company. Plus, xiaxin has some chinese doc too. These should be enough for a good starting point.

Furthermore, you should build something specific to your development process, based on these. My docs for my company have about 50% not quite related to Spring directly, my experience shows this is roughly right.

As for #2, say dao-registration-ibatis-sql.xml, dao-admin-ibatis-storedproc.xml, cert-service-servlet.xml, etc, so you could read them out easily.

Both IBM and MS suck, IBM mainly violates the loosely coupled rule, while MS violates the basic encapsulation rule(remember the system registry?).

11.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: 主管
Posted on: 2004-11-10 09:50

I hava two docs wrote by Dr.xiaxin, i'll find out ur sping doc. ths for your help, Jedi floater

12.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: malulu
Posted on: 2004-11-11 17:46

hi all,
i am a new comer, where can i find the docs your guys talking about?

13.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: floater
Posted on: 2004-11-11 22:45

They are at the top of this board/area.

14.Re:spring项目中Bean的分类和管理方法?哪位有项目经验请交流 [Re: 主管] Copy to clipboard
Posted by: lianghyan
Posted on: 2004-11-17 09:57

我觉得.business bean 可以不要吧!

singleton的Bean一般是无状态的或工具类;
有状态的Bean多是非singleton模式的!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923