0
votes

In my current app (JSF2, Spring 3, Richfaces 4, WebFlow 2.x) have a string which I need session scoped(so each user has their own copy).

My question is how much overhead is involved in creating and maintaining a spring/JSF2 bean in a spring managed container? Should I make a bean just for this string? or should I include this string in an already existing bean? (the user bean in my case). Right now I have the string contained in its own wrapped bean class. My initial thought was that if I included it the string in the User bean, then I would be including a bunch of extra stuff(everything else in the user bean) each time something needs the aforementioned string. eg. it seems to make more sense to just wire up a bean containing just the needed string as apposed to wiring a bean that contains a bunch of extra stuff that never gets used. Anyone have any experience/thoughts on this?

1

1 Answers

1
votes

Here is an article on the spring blog which discusses the impact of proxies on performance.

I don't fully understand your situation, but I don't think it's worth creating a bean for each string. Not because of performance, but because of readability and maintainability. (Also check the spring annotation @Value(..) for injecting primitives)