Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
object which knows runtime parameters and spring bean
Joined: Sep 07, 2009
Nov 02, 2009 02:03:03
I use spring 2.5 and in my application I need to create object which depends on some runtime parameters.
The problem is that I can't use constructor
MyObject myObject = new MyObject(runtimeParameter1, runtimeParameter2);
because MyObject uses spring bean to perform some actions.
So MyObject should be aware of both runtime parameters and spring bean.
Of course it is possible to solve the problem by using the extended constructor
MyObject myObject = new MyObject(runtimeParameter1, runtimeParameter2, mySpringBean);
but in this case i need to inject mySpringBean in the bean which creates MyObject. A kind of "dirty" solution...
Is there a way to instantiate MyObject so that it knows both runtime parameters and bean ?
It is sorta covered in the
JavaRanch Style Guide
subject: object which knows runtime parameters and spring bean
Objects and Instance Variables Confusion...
how to create a null type
objects and references
Newbie Question--Hibernate will not persist
Problem Using toString method from a different class
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013