Allen Gilliland wrote:
My initial opinion is still "mixed bag", but I am definitely willing to
hear more about how you would want to integrate Spring. I still haven't
really done much with Spring, but I do see some ways in which it could
be useful to Roller.
Allen, I definitely recommend that you at least spend a couple of hours
looking at Spring for distributed transactions and pluggable ORM layers
before going ahead with your proposed refactoring of the transaction code.
I'm far from a guru on this subject, but am in alpha testing on an app
that using Spring+Hibernate, so I'm willing to answer any questions to
the best of my ability.
One question I have is are there any controls on what beans someone can
access via Spring? i.e. if I use appfuse as an example I noticed that
there is a bean defined for the Hibernate sessionFactory. is there
anything that prevents someone in the presentation layer from trying
ctx.getBean("sessionFactory")? that is one thing that I wasn't sure
about.
I think Anil has answered this question fairly well, but I believe there
is another option. If you really wanted to keep certain beans
restricted to a particular layer or module, that module could have a
private BeanFactory that the other components are not aware of. In
other words they won't be able to get access to the "ctx"
variable/reference. (In my opinion, this shouldn't be necessary.)
This is the other big thing that I am concerned about with Spring in
Roller. I really don't want go back to making the config more
complicated and spread out.
This is a valid concern and one that Spring doesn't automatically
address. And there is an inherent trade-off in making components more
modular vs. keeping configuration simple and in one place. Anil (and
the team) should address these issues in any proposal(s).
-- Sean