|
From: <jue...@we...> - 2004-03-09 09:47:51
|
You *can* use the standard java.beans.PropertyEditorManager: Spring's = BeanWrapper does not use it to register custom editors, but it does = check it for property editors if no custom ones are found in the = BeanWrapper. As long as there are no overriding custom editors, = PropertyEditorManager's editors are used. =20 So it should indeed be possible to use the VM-wide PropertyEditorManager = here, as suggested by Guillaume! =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Alef Arendsen Gesendet: Fr 05.03.2004 17:19 An: spr...@li... Betreff: RE: [Springframework-developer] "permanantly" registering = property editor with BeanWrapper? Oops, I guess (no I don't guess, I know for sure ;-) manually = instantiating a BeanWrapperImpl won't give you the additional PropertyEditors = registered through CustomEditorConfigurer, if that's what you meant! The = BeanWrapper doesn't know of anything like an ApplicationContext when just = instantiating it. I'm using the BeanWrapperImpl in some rare cases as well (same reason, = it's really convenient). I wouldn't know how to add additional custom editors to beanwrappers instantiated manually. The solution Guillaume is suggesting (with Sun's PropertyManager) will not work; since Spring doesn't use it (security restrictions might give problems there). Alef > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On = Behalf > Of Chris Winters > Sent: Friday, March 05, 2004 4:58 PM > To: spr...@li... > Subject: Re: [Springframework-developer] "permanantly" registering > property editor with BeanWrapper? > > Alef Arendsen wrote: > > It's not possible to do this via a static on the BeanWrapper. It IS > possible > > however... > > > > J=FCrgen added a CustomEditorConfigurer that you can use to do this. = Just > add > > it to you app context and you're done. > > > > <!-- taken from JavaDOC --> > > <bean id=3D"customEditorConfigurer" > > ... > > Excellent! That should work just fine. > > > If you're programmatically using the BeanFactory, you can add > > propertyeditors using registerCustomEditor from the BeanFactory (or = use > a > > BeanFactoryPostProcessor). > > This is what I started doing, but if I instantiate a > BeanWrapperImpl myself the editors aren't available. (I'm just > using the BeanWrapper as a shortcut to do some property mapping > because it's so darned convenient.) > > Plus I'm not sure how to do this from an ApplicationContext vs. a > BeanFactory -- the registerCustomEditor() seems to be implemented > in AbstractBeanFactory which doesn't seem to be a parent of any > ApplicationContext class. (I'm a little hazy on the relationships > among the objects at this level tho.) > > Thanks! > > Chris > > -- > Chris Winters (cwi...@op...) > Senior Software Architect > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |