Am Freitag, 29. Juni 2012 18:27:27 UTC+2 schrieb Lukas Eder: > > Hello, > > > The reason I'm asking is this: If Factory would preserve > the Configuration > > instance, the code to create a new factory could be moved > into Configuration > > - that would allow to pass beans around via the root Configuration (or > an > > extension thereof). > > I've gone through this again. Could you explain why you struggle with > this and how creating a factory from a Configuration would help you? >
getNewFactory() smells because it works mostly on fields of the Configuration instance. It would be more natural to have Configuration.getNewFactory(). That would also get rid of one getNewFactory() method. The next question is what you gain by giving Factory 8 constructors instead of three and move dialect + settings + mapping -> Configuration Factory stores each value of Configuration in a new field; why not delegate to Configuration instead? And lastly, if Configuration would be used as value object/immutable, I would have a single place to create factories which would make it dead simple to inject fields with DI: I'd implement my own Configuration which is shared between all factories and when new factories are created, they are created the way I want. So my preferred constructor would look like: Factory(Configuration) I'll try to implement this and send you a pull. Regards, A. Digulla
