You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(55) |
Mar
(100) |
Apr
(203) |
May
(330) |
Jun
(190) |
Jul
(302) |
Aug
(323) |
Sep
(197) |
Oct
(245) |
Nov
(490) |
Dec
(330) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(194) |
Feb
(400) |
Mar
(416) |
Apr
(415) |
May
(359) |
Jun
(381) |
Jul
(491) |
Aug
(311) |
Sep
(291) |
Oct
(273) |
Nov
(355) |
Dec
(266) |
| 2005 |
Jan
(306) |
Feb
(303) |
Mar
(520) |
Apr
(346) |
May
(255) |
Jun
(221) |
Jul
(171) |
Aug
(247) |
Sep
(147) |
Oct
(125) |
Nov
(165) |
Dec
(65) |
| 2006 |
Jan
(90) |
Feb
(53) |
Mar
(121) |
Apr
(103) |
May
(113) |
Jun
(103) |
Jul
(104) |
Aug
(67) |
Sep
(78) |
Oct
(82) |
Nov
(78) |
Dec
(70) |
| 2007 |
Jan
(77) |
Feb
(76) |
Mar
(63) |
Apr
(30) |
May
(47) |
Jun
(41) |
Jul
(44) |
Aug
(44) |
Sep
(49) |
Oct
(33) |
Nov
(25) |
Dec
(21) |
| 2008 |
Jan
(45) |
Feb
(13) |
Mar
(15) |
Apr
(12) |
May
(9) |
Jun
(33) |
Jul
(30) |
Aug
(7) |
Sep
(20) |
Oct
(17) |
Nov
(20) |
Dec
(10) |
| 2009 |
Jan
(8) |
Feb
(5) |
Mar
(12) |
Apr
(17) |
May
(19) |
Jun
(97) |
Jul
(77) |
Aug
(33) |
Sep
(24) |
Oct
(41) |
Nov
(16) |
Dec
(32) |
| 2010 |
Jan
(24) |
Feb
(14) |
Mar
(50) |
Apr
(71) |
May
(70) |
Jun
(64) |
Jul
(45) |
Aug
(62) |
Sep
(32) |
Oct
(4) |
Nov
(12) |
Dec
(2) |
| 2011 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(6) |
Jun
(1) |
Jul
(4) |
Aug
(3) |
Sep
(4) |
Oct
(6) |
Nov
(3) |
Dec
(3) |
| 2012 |
Jan
(4) |
Feb
(8) |
Mar
(6) |
Apr
(10) |
May
(2) |
Jun
(3) |
Jul
(11) |
Aug
(10) |
Sep
(4) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
(8) |
Jun
(2) |
Jul
(5) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
(10) |
Dec
(8) |
| 2014 |
Jan
(3) |
Feb
(12) |
Mar
(9) |
Apr
(12) |
May
(2) |
Jun
|
Jul
(3) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(2) |
| 2015 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(9) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(7) |
Oct
(9) |
Nov
(7) |
Dec
(9) |
| 2016 |
Jan
(7) |
Feb
(5) |
Mar
(5) |
Apr
(5) |
May
(8) |
Jun
(4) |
Jul
(5) |
Aug
(4) |
Sep
(6) |
Oct
(7) |
Nov
(2) |
Dec
(3) |
| 2017 |
Jan
(7) |
Feb
(8) |
Mar
(7) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(5) |
Aug
(8) |
Sep
(4) |
Oct
(2) |
Nov
(3) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
(5) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2026 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Rod J. <rod...@in...> - 2003-11-20 20:30:49
|
It's meant to be an SPI interface. However I think with the PostProcessor API there may be a call for exposing the BeanDefinition to _That_. Not via the BeanFactoyr interface though. R ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: <spr...@li...> Sent: Thursday, November 20, 2003 8:00 PM Subject: RE: [Springframework-developer] AutoProxyCreator problem > Rajeev, > > You're right. There is no public API for getBeanDefinition(). There is a > protected abstract getBeanDefinition(String) in AbstractBeanFactory designed > for subclasses to implement "Template Method" design pattern. > > Regards, > Dmitriy. > > -----Original Message----- > From: Rajeev Kaul [mailto:Ra...@cu...] > Sent: Thursday, November 20, 2003 2:39 PM > To: spr...@li... > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > > Dmitry, > > How do you get the bean definition from a bean factory? There does not seem > to be any public method for it. > > regards, > > Rajeev > ----- Original Message ----- > From: "Kopylenko, Dmitry" <dko...@su...> > To: "'Rajeev Kaul '" <Ra...@cu...>; > <spr...@li...> > Sent: Wednesday, November 19, 2003 5:16 PM > Subject: RE: [Springframework-developer] AutoProxyCreator problem > > > > As to your first problem, you would need to create a new instance of > > the BeanFactory Consider the following piece of code (taken from > > EnterpriseServices.createInvokerInterceptor() ): > > > > // Infinite cycle: tries to create the bean if we don't use a > > different factory ListableBeanFactoryImpl bf2 = new > > ListableBeanFactoryImpl(); bf2.registerBeanDefinition(beanName, > > definition); cpii.setBeanFactory(bf2); > > > > ...where cpii is the reference of type > > AbstractPoolingInvokerInterceptor which extends > > PrototypeInvokerInterceptor > > > > I guess this is what you need. > > > > Dmitriy. > > > > -----Original Message----- > > From: Rajeev Kaul > > To: spr...@li... > > Sent: 11/19/2003 7:33 PM > > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > > > I am thinking of a solution for condensing the verbose configuration > > (shown below) for prototype business logic beans I am using in my > > application. A shared controller instance (singelton) creates the > > business logic bean. However the business logic bean must be > > instantiated per each thread that runs through the shared controller. > > I have been using the configuration shown below: > > > > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> > > > > <property name="count"><value>10</value></property> > > > > </bean> > > > > <bean id="prototypeInvokerInterceptor" > > class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor > > "> > > > > > > <property > > name="targetBeanName"><value>prototypeBean</value></property> > > > > </bean> > > > > <bean id="prototype" > > class="org.springframework.aop.framework.ProxyFactoryBean"> > > > > <property > > name="interceptorNames"><value>prototypeInvokerInterceptor</value></pr > > op > > erty> > > > > </bean> > > > > > > > > As you can see this is very verbose, especially if you have a lot of > > these business logic beans in your application. I tried using a > > derived version of BeanNameAutoProxyCreator to solve this, but ran > > into problems. I would like to replace this configuration with > > something shown below: > > > > > > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" > > proxy="prototype"> > > > > <property name="count"><value>10</value></property> > > > > </bean> > > > > This would involve adding a "PROXY" attribute which would specify the > > type of proxy interceptor desired for the bean. For example, > > "prototype" would mean ProxyFactoryBean with > > PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean > > with InvokerInterceptor, etc. In loadBeanDefinition() method of the > > XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean > > and PrototypeInvokerInterceptor) could be automatically generated and > > registered. > > > > Any suggestions, comments, ...? > > > > > > > > Rajeev > > > > ----- Original Message ----- > > From: Rajeev Kaul <mailto:Ra...@cu...> > > To: spr...@li... > > <mailto:spr...@li...> > > Sent: Tuesday, November 18, 2003 1:29 PM > > Subject: [Springframework-developer] AutoProxyCreator problem > > > > > > I have been trying to use BeanNameAutoProxyCreator class (I noticed > > there are no test cases for it) to create proxies for "prototype" > > business objects. I extended the BeanNameAutoProxyCreator class to use > > the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" > > method. However, this results in an infinite loop, as the > > PrototypeInvokerInterceptor calls the beanFactory getBean() method > > which in turn triggers the beanPostProcessor and the cycle repeats > > endlessly. > > > > Any suggestions on getting around this problem? > > > > It would have been better, if the BeanNameAutoProxyCreator class was > > designed to take invokerInterceptor as a property, which could be > > specified in the configuration, instead of having to subclass it to > > use other invokerInterceptor(s). > > > > Rajeev Kaul > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. Does > > SourceForge.net help you be more productive? Does it help you create > > better code? SHARE THE LOVE, and help us help YOU! Click Here: > > http://sourceforge.net/donate/ > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. Does > SourceForge.net help you be more productive? Does it help you create better > code? SHARE THE LOVE, and help us help YOU! Click Here: > http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-20 20:00:43
|
Rajeev, You're right. There is no public API for getBeanDefinition(). There is a protected abstract getBeanDefinition(String) in AbstractBeanFactory designed for subclasses to implement "Template Method" design pattern. Regards, Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Thursday, November 20, 2003 2:39 PM To: spr...@li... Subject: Re: [Springframework-developer] AutoProxyCreator problem Dmitry, How do you get the bean definition from a bean factory? There does not seem to be any public method for it. regards, Rajeev ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: "'Rajeev Kaul '" <Ra...@cu...>; <spr...@li...> Sent: Wednesday, November 19, 2003 5:16 PM Subject: RE: [Springframework-developer] AutoProxyCreator problem > As to your first problem, you would need to create a new instance of > the BeanFactory Consider the following piece of code (taken from > EnterpriseServices.createInvokerInterceptor() ): > > // Infinite cycle: tries to create the bean if we don't use a > different factory ListableBeanFactoryImpl bf2 = new > ListableBeanFactoryImpl(); bf2.registerBeanDefinition(beanName, > definition); cpii.setBeanFactory(bf2); > > ...where cpii is the reference of type > AbstractPoolingInvokerInterceptor which extends > PrototypeInvokerInterceptor > > I guess this is what you need. > > Dmitriy. > > -----Original Message----- > From: Rajeev Kaul > To: spr...@li... > Sent: 11/19/2003 7:33 PM > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > I am thinking of a solution for condensing the verbose configuration > (shown below) for prototype business logic beans I am using in my > application. A shared controller instance (singelton) creates the > business logic bean. However the business logic bean must be > instantiated per each thread that runs through the shared controller. > I have been using the configuration shown below: > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> > > <property name="count"><value>10</value></property> > > </bean> > > <bean id="prototypeInvokerInterceptor" > class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor > "> > > > <property > name="targetBeanName"><value>prototypeBean</value></property> > > </bean> > > <bean id="prototype" > class="org.springframework.aop.framework.ProxyFactoryBean"> > > <property > name="interceptorNames"><value>prototypeInvokerInterceptor</value></pr > op > erty> > > </bean> > > > > As you can see this is very verbose, especially if you have a lot of > these business logic beans in your application. I tried using a > derived version of BeanNameAutoProxyCreator to solve this, but ran > into problems. I would like to replace this configuration with > something shown below: > > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" > proxy="prototype"> > > <property name="count"><value>10</value></property> > > </bean> > > This would involve adding a "PROXY" attribute which would specify the > type of proxy interceptor desired for the bean. For example, > "prototype" would mean ProxyFactoryBean with > PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean > with InvokerInterceptor, etc. In loadBeanDefinition() method of the > XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean > and PrototypeInvokerInterceptor) could be automatically generated and > registered. > > Any suggestions, comments, ...? > > > > Rajeev > > ----- Original Message ----- > From: Rajeev Kaul <mailto:Ra...@cu...> > To: spr...@li... > <mailto:spr...@li...> > Sent: Tuesday, November 18, 2003 1:29 PM > Subject: [Springframework-developer] AutoProxyCreator problem > > > I have been trying to use BeanNameAutoProxyCreator class (I noticed > there are no test cases for it) to create proxies for "prototype" > business objects. I extended the BeanNameAutoProxyCreator class to use > the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" > method. However, this results in an infinite loop, as the > PrototypeInvokerInterceptor calls the beanFactory getBean() method > which in turn triggers the beanPostProcessor and the cycle repeats > endlessly. > > Any suggestions on getting around this problem? > > It would have been better, if the BeanNameAutoProxyCreator class was > designed to take invokerInterceptor as a property, which could be > specified in the configuration, instead of having to subclass it to > use other invokerInterceptor(s). > > Rajeev Kaul > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. Does > SourceForge.net help you be more productive? Does it help you create > better code? SHARE THE LOVE, and help us help YOU! Click Here: > http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: roger h. <apo...@sn...> - 2003-11-20 19:46:34
|
Hi Juergen
As Mark's experience has just demonstrated, the fact that FactoryBean's are
not required to be singleton's does provide a very ready source of confusion
for the uninitiated. The only reason I was aware of this problem, was
because initially I too was very confused, until I had spent good deal of
time working out what the code was actually doing.
I would definitely favour option 2.
While we're on the subject of FactoryBean's and their curiosities, another
thing that took me a long time to work out was the non-uniform dereferencing
of factory bean names. ie isSingleton() and getBean() do not behave
consistently.
If I have a prototype FactoryBean named "proto", ie:
<bean id="proto"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="singleton"><value>false</value></property>
</bean>
a call to
beanFactory.isSingleton("proto");
will return true, but repeated calls to
beaFactory.getBean("proto")
will indeed return separate prototype instances.
Personally, I find this very counterintuitive and would be happy to see this
changed ;)
Roger
"jürgen höller [werk3AT]" <jue...@we...> wrote in message
news:170...@co......
Roger,
This is indeed true, and I have not been aware of it: If a FactoryBean is
defined as prototype, getBean will currently return the FactoryBean itself.
There are obviously two solutions for this:
1. make getBean return the FactoryBean-created object even for FactoryBean
prototypes
2. require FactoryBeans to be defined as singletons by forbidding
singleton="false"
Option 2 isn't bad in the first place, as it's hard to image why a
FactoryBean itself should be a prototype. Of course, option 1 could be
easily implemented too, and it leaves the choice to the application
developer. Opinions?
We should definitely address this for 1.0 M3, to be released this weekend!
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of roger holbrook
Sent: Thursday, November 20, 2003 7:28 PM
To: spr...@li...
Subject: [Springframework-developer] Re: Intercepting a Prototype Bean
Rod
I think this is a probably bug in AbstractBeanFactory - currently any
getBean() for a FactoryBean that was defined with a bean attribute of
singleton="false", will always return the FactoryBean instance, rather than
a Proxy instance. This happens because createBean() does not do any factory
dereferencing.
One fix would just be to trap the combination when the beans are being
defined.
Even if createBean() were actually handling the dereferencing correctly,
I think there would still be a problem on a normal sequence of getBean()
calls - since each call would generate a new FactoryBean instance and a new
Proxy instance, but the application code would only ever see a reference to
the latter. Application code would only be able collect references to the
FactoryBean themselves by explicitly calling getBean("&name"), and then
using these to generate Proxy instances.
A bit confusing really
Roger
"Rod Johnson" <rod...@in...> wrote in message
news:06aa01c3af8b$d4467c90$e900a8c0@chopin...
> Mark,
>
> > Is it possible to apply an interceptor to a prototype bean?
> Yes.
>
> > The prototype is stateful - i.e one per user
> Yes, Spring supports mixins, ie one interceptor per mixin instance.
>
> > I have defined the following in applicationContext.xml
> >
> >
> > <bean id="TestTarget" class="test.MyTarget" singleton="false">
> > </bean>
> >
> >
> > <bean id="TestInterceptor"
> >
>
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
> > an" singleton="false">
> > <property name="transactionManager"><ref
> > local="transactionManager"/></property>
> >
> > <property name="target"><ref local="TestTarget"/></property>
> >
> >
> > <property name="transactionAttributes">
> > <props>
> > <prop key="foo">PROPAGATION_REQUIRED</prop>
> > </props>
> > </property>
> > </bean>
> >
> >
> >
> > When I invoke the method foo I get a ClassCastException
>
> Not sure why this is happening but you may need to create the interceptor
> chain manually to use a prototype, as TransactionProxyFactoryBean propably
> assumes it's dealing with a singleton. So you need to create a chain that
> includes:
> - the name of your prototype
> - the interceptor names, which may be singletons or prototypes as you
> require. Use a prototype for mixin support.
>
> The following example comes from the test suite, with minor changes to
make
> it more obvious:
>
>
> <bean id="prototypeTarget"
> class="org.springframework.aop.interceptor.SideEffectBean"
> singleton="false">
> <property name="count"><value>10</value></property>
> </bean>
>
> <!-- This can be a singleton or a prototype (for mixin behaviour) -->
> <bean id="debugInterceptor"
> class="org.springframework.aop.interceptor.DebugInterceptor">
> </bean>
>
>
> <bean id="prototype"
> class="org.springframework.aop.framework.ProxyFactoryBean">
> <!-- will automatically create invoker interceptor for the prototype -->
> <property
>
name="interceptorNames"><value>debugInterceptor,prototypeTarget</value></pro
> perty>
>
> <!-- Note this -->
> <property name="singleton"><value>false</value></property>
> </bean>
>
> There is a bug in M2 to do with prototype AOP handling, which is fixed in
> the forthcoming M3. However I don't think it should affect you in such a
> simple usage.
>
>
> Regards,
> Rod
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
|
|
From: Rajeev K. <Ra...@cu...> - 2003-11-20 19:40:38
|
Dmitry, How do you get the bean definition from a bean factory? There does not seem to be any public method for it. regards, Rajeev ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: "'Rajeev Kaul '" <Ra...@cu...>; <spr...@li...> Sent: Wednesday, November 19, 2003 5:16 PM Subject: RE: [Springframework-developer] AutoProxyCreator problem > As to your first problem, you would need to create a new instance of the > BeanFactory > Consider the following piece of code (taken from > EnterpriseServices.createInvokerInterceptor() ): > > // Infinite cycle: tries to create the bean if we don't use a different > factory > ListableBeanFactoryImpl bf2 = new ListableBeanFactoryImpl(); > bf2.registerBeanDefinition(beanName, definition); > cpii.setBeanFactory(bf2); > > ...where cpii is the reference of type AbstractPoolingInvokerInterceptor > which extends PrototypeInvokerInterceptor > > I guess this is what you need. > > Dmitriy. > > -----Original Message----- > From: Rajeev Kaul > To: spr...@li... > Sent: 11/19/2003 7:33 PM > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > I am thinking of a solution for condensing the verbose configuration > (shown below) for prototype business logic beans I am using in my > application. A shared controller instance (singelton) creates the > business logic bean. However the business logic bean must be > instantiated per each thread that runs through the shared controller. I > have been using the configuration shown below: > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> > > <property name="count"><value>10</value></property> > > </bean> > > <bean id="prototypeInvokerInterceptor" > class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor"> > > > <property name="targetBeanName"><value>prototypeBean</value></property> > > </bean> > > <bean id="prototype" > class="org.springframework.aop.framework.ProxyFactoryBean"> > > <property > name="interceptorNames"><value>prototypeInvokerInterceptor</value></prop > erty> > > </bean> > > > > As you can see this is very verbose, especially if you have a lot of > these business logic beans in your application. I tried using a derived > version of BeanNameAutoProxyCreator to solve this, but ran into > problems. I would like to replace this configuration with something > shown below: > > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" > proxy="prototype"> > > <property name="count"><value>10</value></property> > > </bean> > > This would involve adding a "PROXY" attribute which would specify the > type of proxy interceptor desired for the bean. For example, > "prototype" would mean ProxyFactoryBean with > PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with > InvokerInterceptor, etc. In loadBeanDefinition() method of the > XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean > and PrototypeInvokerInterceptor) could be automatically generated and > registered. > > Any suggestions, comments, ...? > > > > Rajeev > > ----- Original Message ----- > From: Rajeev Kaul <mailto:Ra...@cu...> > To: spr...@li... > <mailto:spr...@li...> > Sent: Tuesday, November 18, 2003 1:29 PM > Subject: [Springframework-developer] AutoProxyCreator problem > > > I have been trying to use BeanNameAutoProxyCreator class (I noticed > there are no test cases for it) to create proxies for "prototype" > business objects. I extended the BeanNameAutoProxyCreator class to use > the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" > method. However, this results in an infinite loop, as the > PrototypeInvokerInterceptor calls the beanFactory getBean() method which > in turn triggers the beanPostProcessor and the cycle repeats endlessly. > > Any suggestions on getting around this problem? > > It would have been better, if the BeanNameAutoProxyCreator class was > designed to take invokerInterceptor as a property, which could be > specified in the configuration, instead of having to subclass it to use > other invokerInterceptor(s). > > Rajeev Kaul > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Rod J. <rod...@in...> - 2003-11-20 19:19:53
|
Option 2, as I say in the email which I obviously wrote at the same time as
yours and which hasn't shown up on the list yet.
----- Original Message -----
From: "jürgen höller [werk3AT]" <jue...@we...>
To: <spr...@li...>
Sent: Thursday, November 20, 2003 6:56 PM
Subject: RE: [Springframework-developer] Re: Intercepting a Prototype Bean
Roger,
This is indeed true, and I have not been aware of it: If a FactoryBean is
defined as prototype, getBean will currently return the FactoryBean itself.
There are obviously two solutions for this:
1. make getBean return the FactoryBean-created object even for FactoryBean
prototypes
2. require FactoryBeans to be defined as singletons by forbidding
singleton="false"
Option 2 isn't bad in the first place, as it's hard to image why a
FactoryBean itself should be a prototype. Of course, option 1 could be
easily implemented too, and it leaves the choice to the application
developer. Opinions?
We should definitely address this for 1.0 M3, to be released this weekend!
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of roger holbrook
Sent: Thursday, November 20, 2003 7:28 PM
To: spr...@li...
Subject: [Springframework-developer] Re: Intercepting a Prototype Bean
Rod
I think this is a probably bug in AbstractBeanFactory - currently any
getBean() for a FactoryBean that was defined with a bean attribute of
singleton="false", will always return the FactoryBean instance, rather than
a Proxy instance. This happens because createBean() does not do any factory
dereferencing.
One fix would just be to trap the combination when the beans are being
defined.
Even if createBean() were actually handling the dereferencing correctly,
I think there would still be a problem on a normal sequence of getBean()
calls - since each call would generate a new FactoryBean instance and a new
Proxy instance, but the application code would only ever see a reference to
the latter. Application code would only be able collect references to the
FactoryBean themselves by explicitly calling getBean("&name"), and then
using these to generate Proxy instances.
A bit confusing really
Roger
"Rod Johnson" <rod...@in...> wrote in message
news:06aa01c3af8b$d4467c90$e900a8c0@chopin...
> Mark,
>
> > Is it possible to apply an interceptor to a prototype bean?
> Yes.
>
> > The prototype is stateful - i.e one per user
> Yes, Spring supports mixins, ie one interceptor per mixin instance.
>
> > I have defined the following in applicationContext.xml
> >
> >
> > <bean id="TestTarget" class="test.MyTarget" singleton="false">
> > </bean>
> >
> >
> > <bean id="TestInterceptor"
> >
>
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
> > an" singleton="false">
> > <property name="transactionManager"><ref
> > local="transactionManager"/></property>
> >
> > <property name="target"><ref local="TestTarget"/></property>
> >
> >
> > <property name="transactionAttributes">
> > <props>
> > <prop key="foo">PROPAGATION_REQUIRED</prop>
> > </props>
> > </property>
> > </bean>
> >
> >
> >
> > When I invoke the method foo I get a ClassCastException
>
> Not sure why this is happening but you may need to create the interceptor
> chain manually to use a prototype, as TransactionProxyFactoryBean propably
> assumes it's dealing with a singleton. So you need to create a chain that
> includes:
> - the name of your prototype
> - the interceptor names, which may be singletons or prototypes as you
> require. Use a prototype for mixin support.
>
> The following example comes from the test suite, with minor changes to
make
> it more obvious:
>
>
> <bean id="prototypeTarget"
> class="org.springframework.aop.interceptor.SideEffectBean"
> singleton="false">
> <property name="count"><value>10</value></property>
> </bean>
>
> <!-- This can be a singleton or a prototype (for mixin behaviour) -->
> <bean id="debugInterceptor"
> class="org.springframework.aop.interceptor.DebugInterceptor">
> </bean>
>
>
> <bean id="prototype"
> class="org.springframework.aop.framework.ProxyFactoryBean">
> <!-- will automatically create invoker interceptor for the prototype -->
> <property
>
name="interceptorNames"><value>debugInterceptor,prototypeTarget</value></pro
> perty>
>
> <!-- Note this -->
> <property name="singleton"><value>false</value></property>
> </bean>
>
> There is a bug in M2 to do with prototype AOP handling, which is fixed in
> the forthcoming M3. However I don't think it should affect you in such a
> simple usage.
>
>
> Regards,
> Rod
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Rod J. <rod...@in...> - 2003-11-20 19:13:44
|
My original intention was that FactoryBeans must be singletons and that
attempts to define them as prototypes should throw a
BeanDefinitionStoreException. One level of indirection should be enough.
Regards,
Rod
----- Original Message -----
From: "roger holbrook" <apo...@sn...>
To: <spr...@li...>
Sent: Thursday, November 20, 2003 6:28 PM
Subject: [Springframework-developer] Re: Intercepting a Prototype Bean
> Rod
>
> I think this is a probably bug in AbstractBeanFactory - currently any
> getBean() for a FactoryBean that was defined with a bean attribute of
> singleton="false", will always return the FactoryBean instance, rather
than
> a Proxy instance. This happens because createBean() does not do any
factory
> dereferencing.
>
> One fix would just be to trap the combination when the beans are being
> defined.
>
> Even if createBean() were actually handling the dereferencing correctly,
> I think there would still be a problem on a normal sequence of getBean()
> calls - since each call would generate a new FactoryBean instance and a
new
> Proxy instance, but the application code would only ever see a reference
to
> the latter. Application code would only be able collect references to the
> FactoryBean themselves by explicitly calling getBean("&name"), and then
> using these to generate Proxy instances.
>
> A bit confusing really
>
> Roger
>
>
> "Rod Johnson" <rod...@in...> wrote in message
> news:06aa01c3af8b$d4467c90$e900a8c0@chopin...
> > Mark,
> >
> > > Is it possible to apply an interceptor to a prototype bean?
> > Yes.
> >
> > > The prototype is stateful - i.e one per user
> > Yes, Spring supports mixins, ie one interceptor per mixin instance.
> >
> > > I have defined the following in applicationContext.xml
> > >
> > >
> > > <bean id="TestTarget" class="test.MyTarget" singleton="false">
> > > </bean>
> > >
> > >
> > > <bean id="TestInterceptor"
> > >
> >
>
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
> > > an" singleton="false">
> > > <property name="transactionManager"><ref
> > > local="transactionManager"/></property>
> > >
> > > <property name="target"><ref local="TestTarget"/></property>
> > >
> > >
> > > <property name="transactionAttributes">
> > > <props>
> > > <prop key="foo">PROPAGATION_REQUIRED</prop>
> > > </props>
> > > </property>
> > > </bean>
> > >
> > >
> > >
> > > When I invoke the method foo I get a ClassCastException
> >
> > Not sure why this is happening but you may need to create the
interceptor
> > chain manually to use a prototype, as TransactionProxyFactoryBean
propably
> > assumes it's dealing with a singleton. So you need to create a chain
that
> > includes:
> > - the name of your prototype
> > - the interceptor names, which may be singletons or prototypes as you
> > require. Use a prototype for mixin support.
> >
> > The following example comes from the test suite, with minor changes to
> make
> > it more obvious:
> >
> >
> > <bean id="prototypeTarget"
> > class="org.springframework.aop.interceptor.SideEffectBean"
> > singleton="false">
> > <property name="count"><value>10</value></property>
> > </bean>
> >
> > <!-- This can be a singleton or a prototype (for mixin behaviour) -->
> > <bean id="debugInterceptor"
> > class="org.springframework.aop.interceptor.DebugInterceptor">
> > </bean>
> >
> >
> > <bean id="prototype"
> > class="org.springframework.aop.framework.ProxyFactoryBean">
> > <!-- will automatically create invoker interceptor for the
prototype -->
> > <property
> >
>
name="interceptorNames"><value>debugInterceptor,prototypeTarget</value></pro
> > perty>
> >
> > <!-- Note this -->
> > <property name="singleton"><value>false</value></property>
> > </bean>
> >
> > There is a bug in M2 to do with prototype AOP handling, which is fixed
in
> > the forthcoming M3. However I don't think it should affect you in such a
> > simple usage.
> >
> >
> > Regards,
> > Rod
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive? Does it
> > help you create better code? SHARE THE LOVE, and help us help
> > YOU! Click Here: http://sourceforge.net/donate/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Rajeev K. <Ra...@cu...> - 2003-11-20 19:04:33
|
I have implemented this in my version of the spring framework. If there =
is interest, I will be happy to submit the code.
----- Original Message -----=20
From: Rajeev Kaul=20
To: spr...@li...=20
Sent: Wednesday, November 19, 2003 4:33 PM
Subject: Re: [Springframework-developer] AutoProxyCreator problem
I am thinking of a solution for condensing the verbose configuration =
(shown below) for prototype business logic beans I am using in my =
application. A shared controller instance (singelton) creates the =
business logic bean. However the business logic bean must be =
instantiated per each thread that runs through the shared controller. I =
have been using the configuration shown below:
<bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" =
singleton=3D"false">=20
<property name=3D"count"><value>10</value></property>
</bean>
<bean id=3D"prototypeInvokerInterceptor" =
class=3D"org.springframework.aop.interceptor.PrototypeInvokerInterceptor"=
>=20
<property =
name=3D"targetBeanName"><value>prototypeBean</value></property>
</bean>
<bean id=3D"prototype" =
class=3D"org.springframework.aop.framework.ProxyFactoryBean">=20
<property =
name=3D"interceptorNames"><value>prototypeInvokerInterceptor</value></pro=
perty>
</bean>
As you can see this is very verbose, especially if you have a lot of =
these business logic beans in your application. I tried using a derived =
version of BeanNameAutoProxyCreator to solve this, but ran into =
problems. I would like to replace this configuration with something =
shown below:
<bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" =
singleton=3D"false" proxy=3D"prototype">=20
<property name=3D"count"><value>10</value></property>
</bean>
This would involve adding a "PROXY" attribute which would specify the =
type of proxy interceptor desired for the bean. For example, =
"prototype" would mean ProxyFactoryBean with =
PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with =
InvokerInterceptor, etc. In loadBeanDefinition() method of the =
XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean =
and PrototypeInvokerInterceptor) could be automatically generated and =
registered.
Any suggestions, comments, ...?
Rajeev
----- Original Message -----=20
From: Rajeev Kaul=20
To: spr...@li...=20
Sent: Tuesday, November 18, 2003 1:29 PM
Subject: [Springframework-developer] AutoProxyCreator problem
I have been trying to use BeanNameAutoProxyCreator class (I noticed =
there are no test cases for it) to create proxies for "prototype" =
business objects. I extended the BeanNameAutoProxyCreator class to use =
the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" =
method. However, this results in an infinite loop, as the =
PrototypeInvokerInterceptor calls the beanFactory getBean() method which =
in turn triggers the beanPostProcessor and the cycle repeats endlessly.
Any suggestions on getting around this problem?
It would have been better, if the BeanNameAutoProxyCreator class was =
designed to take invokerInterceptor as a property, which could be =
specified in the configuration, instead of having to subclass it to use =
other invokerInterceptor(s).=20
Rajeev Kaul
|
|
From: <jue...@we...> - 2003-11-20 18:59:04
|
Roger,
This is indeed true, and I have not been aware of it: If a FactoryBean =
is defined as prototype, getBean will currently return the FactoryBean =
itself.
There are obviously two solutions for this:
1. make getBean return the FactoryBean-created object even for =
FactoryBean prototypes
2. require FactoryBeans to be defined as singletons by forbidding =
singleton=3D"false"
Option 2 isn't bad in the first place, as it's hard to image why a =
FactoryBean itself should be a prototype. Of course, option 1 could be =
easily implemented too, and it leaves the choice to the application =
developer. Opinions?
We should definitely address this for 1.0 M3, to be released this =
weekend!
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of roger holbrook
Sent: Thursday, November 20, 2003 7:28 PM
To: spr...@li...
Subject: [Springframework-developer] Re: Intercepting a Prototype Bean
Rod
I think this is a probably bug in AbstractBeanFactory - currently any
getBean() for a FactoryBean that was defined with a bean attribute of
singleton=3D"false", will always return the FactoryBean instance, rather =
than
a Proxy instance. This happens because createBean() does not do any =
factory
dereferencing.
One fix would just be to trap the combination when the beans are being
defined.
Even if createBean() were actually handling the dereferencing correctly,
I think there would still be a problem on a normal sequence of getBean()
calls - since each call would generate a new FactoryBean instance and a =
new
Proxy instance, but the application code would only ever see a reference =
to
the latter. Application code would only be able collect references to =
the
FactoryBean themselves by explicitly calling getBean("&name"), and then
using these to generate Proxy instances.
A bit confusing really
Roger
"Rod Johnson" <rod...@in...> wrote in message
news:06aa01c3af8b$d4467c90$e900a8c0@chopin...
> Mark,
>
> > Is it possible to apply an interceptor to a prototype bean?
> Yes.
>
> > The prototype is stateful - i.e one per user
> Yes, Spring supports mixins, ie one interceptor per mixin instance.
>
> > I have defined the following in applicationContext.xml
> >
> >
> > <bean id=3D"TestTarget" class=3D"test.MyTarget" singleton=3D"false">
> > </bean>
> >
> >
> > <bean id=3D"TestInterceptor"
> >
>
class=3D"org.springframework.transaction.interceptor.TransactionProxyFact=
oryBe
> > an" singleton=3D"false">
> > <property name=3D"transactionManager"><ref
> > local=3D"transactionManager"/></property>
> >
> > <property name=3D"target"><ref local=3D"TestTarget"/></property>
> >
> >
> > <property name=3D"transactionAttributes">
> > <props>
> > <prop key=3D"foo">PROPAGATION_REQUIRED</prop>
> > </props>
> > </property>
> > </bean>
> >
> >
> >
> > When I invoke the method foo I get a ClassCastException
>
> Not sure why this is happening but you may need to create the =
interceptor
> chain manually to use a prototype, as TransactionProxyFactoryBean =
propably
> assumes it's dealing with a singleton. So you need to create a chain =
that
> includes:
> - the name of your prototype
> - the interceptor names, which may be singletons or prototypes as you
> require. Use a prototype for mixin support.
>
> The following example comes from the test suite, with minor changes to
make
> it more obvious:
>
>
> <bean id=3D"prototypeTarget"
> class=3D"org.springframework.aop.interceptor.SideEffectBean"
> singleton=3D"false">
> <property name=3D"count"><value>10</value></property>
> </bean>
>
> <!-- This can be a singleton or a prototype (for mixin behaviour) -->
> <bean id=3D"debugInterceptor"
> class=3D"org.springframework.aop.interceptor.DebugInterceptor">
> </bean>
>
>
> <bean id=3D"prototype"
> class=3D"org.springframework.aop.framework.ProxyFactoryBean">
> <!-- will automatically create invoker interceptor for the prototype =
-->
> <property
>
name=3D"interceptorNames"><value>debugInterceptor,prototypeTarget</value>=
</pro
> perty>
>
> <!-- Note this -->
> <property name=3D"singleton"><value>false</value></property>
> </bean>
>
> There is a bug in M2 to do with prototype AOP handling, which is fixed =
in
> the forthcoming M3. However I don't think it should affect you in such =
a
> simple usage.
>
>
> Regards,
> Rod
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: roger h. <apo...@sn...> - 2003-11-20 18:29:20
|
Rod
I think this is a probably bug in AbstractBeanFactory - currently any
getBean() for a FactoryBean that was defined with a bean attribute of
singleton="false", will always return the FactoryBean instance, rather than
a Proxy instance. This happens because createBean() does not do any factory
dereferencing.
One fix would just be to trap the combination when the beans are being
defined.
Even if createBean() were actually handling the dereferencing correctly,
I think there would still be a problem on a normal sequence of getBean()
calls - since each call would generate a new FactoryBean instance and a new
Proxy instance, but the application code would only ever see a reference to
the latter. Application code would only be able collect references to the
FactoryBean themselves by explicitly calling getBean("&name"), and then
using these to generate Proxy instances.
A bit confusing really
Roger
"Rod Johnson" <rod...@in...> wrote in message
news:06aa01c3af8b$d4467c90$e900a8c0@chopin...
> Mark,
>
> > Is it possible to apply an interceptor to a prototype bean?
> Yes.
>
> > The prototype is stateful - i.e one per user
> Yes, Spring supports mixins, ie one interceptor per mixin instance.
>
> > I have defined the following in applicationContext.xml
> >
> >
> > <bean id="TestTarget" class="test.MyTarget" singleton="false">
> > </bean>
> >
> >
> > <bean id="TestInterceptor"
> >
>
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
> > an" singleton="false">
> > <property name="transactionManager"><ref
> > local="transactionManager"/></property>
> >
> > <property name="target"><ref local="TestTarget"/></property>
> >
> >
> > <property name="transactionAttributes">
> > <props>
> > <prop key="foo">PROPAGATION_REQUIRED</prop>
> > </props>
> > </property>
> > </bean>
> >
> >
> >
> > When I invoke the method foo I get a ClassCastException
>
> Not sure why this is happening but you may need to create the interceptor
> chain manually to use a prototype, as TransactionProxyFactoryBean propably
> assumes it's dealing with a singleton. So you need to create a chain that
> includes:
> - the name of your prototype
> - the interceptor names, which may be singletons or prototypes as you
> require. Use a prototype for mixin support.
>
> The following example comes from the test suite, with minor changes to
make
> it more obvious:
>
>
> <bean id="prototypeTarget"
> class="org.springframework.aop.interceptor.SideEffectBean"
> singleton="false">
> <property name="count"><value>10</value></property>
> </bean>
>
> <!-- This can be a singleton or a prototype (for mixin behaviour) -->
> <bean id="debugInterceptor"
> class="org.springframework.aop.interceptor.DebugInterceptor">
> </bean>
>
>
> <bean id="prototype"
> class="org.springframework.aop.framework.ProxyFactoryBean">
> <!-- will automatically create invoker interceptor for the prototype -->
> <property
>
name="interceptorNames"><value>debugInterceptor,prototypeTarget</value></pro
> perty>
>
> <!-- Note this -->
> <property name="singleton"><value>false</value></property>
> </bean>
>
> There is a bug in M2 to do with prototype AOP handling, which is fixed in
> the forthcoming M3. However I don't think it should affect you in such a
> simple usage.
>
>
> Regards,
> Rod
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
|
|
From: Rod J. <rod...@in...> - 2003-11-20 17:42:11
|
Mark, > Is it possible to apply an interceptor to a prototype bean? Yes. > The prototype is stateful - i.e one per user Yes, Spring supports mixins, ie one interceptor per mixin instance. > I have defined the following in applicationContext.xml > > > <bean id="TestTarget" class="test.MyTarget" singleton="false"> > </bean> > > > <bean id="TestInterceptor" > class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe > an" singleton="false"> > <property name="transactionManager"><ref > local="transactionManager"/></property> > > <property name="target"><ref local="TestTarget"/></property> > > > <property name="transactionAttributes"> > <props> > <prop key="foo">PROPAGATION_REQUIRED</prop> > </props> > </property> > </bean> > > > > When I invoke the method foo I get a ClassCastException Not sure why this is happening but you may need to create the interceptor chain manually to use a prototype, as TransactionProxyFactoryBean propably assumes it's dealing with a singleton. So you need to create a chain that includes: - the name of your prototype - the interceptor names, which may be singletons or prototypes as you require. Use a prototype for mixin support. The following example comes from the test suite, with minor changes to make it more obvious: <bean id="prototypeTarget" class="org.springframework.aop.interceptor.SideEffectBean" singleton="false"> <property name="count"><value>10</value></property> </bean> <!-- This can be a singleton or a prototype (for mixin behaviour) --> <bean id="debugInterceptor" class="org.springframework.aop.interceptor.DebugInterceptor"> </bean> <bean id="prototype" class="org.springframework.aop.framework.ProxyFactoryBean"> <!-- will automatically create invoker interceptor for the prototype --> <property name="interceptorNames"><value>debugInterceptor,prototypeTarget</value></pro perty> <!-- Note this --> <property name="singleton"><value>false</value></property> </bean> There is a bug in M2 to do with prototype AOP handling, which is fixed in the forthcoming M3. However I don't think it should affect you in such a simple usage. Regards, Rod |
|
From: MacMahon, M. <M.M...@em...> - 2003-11-20 17:21:24
|
Hi all, Is it possible to apply an interceptor to a prototype bean? The prototype is stateful - i.e one per user I have defined the following in applicationContext.xml <bean id="TestTarget" class="test.MyTarget" singleton="false"> </bean> <bean id="TestInterceptor" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe an" singleton="false"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="TestTarget"/></property> <property name="transactionAttributes"> <props> <prop key="foo">PROPAGATION_REQUIRED</prop> </props> </property> </bean> When I invoke the method foo I get a ClassCastException If I change the TestInterceptor to singleton="true", it works fine but the bean is no longer a prototype! Is this a bug or a feature? Any help much appreciated, Regards, Mark. ____________________________________________________ emuse technologies U24 Trinity Enterprise Centre, Pearse Street, Dublin 2, Ireland. Tel: +353 (0)1 6717317 Fax: +353 (0)1 6717319 website: <http://www.emusetechnologies.com/> email: in...@em... <mailto:in...@em...> ____________________________________________________ This message has been scanned for viruses using GroupShield for Exchange Server. CONFIDENTIALITY NOTICE - The information contained in this email message is intended only for confidential use of the named recipient. If the reader is not the intended recipient or the person responsible for delivering it to the recipient, you are hereby notified that you have received this communication in error and that any review, dissemination or copying of this communication is strictly prohibited. If you have received this in error, please notify the sender immediately. The information, opinions and recommendations contained herein are and must be construed solely as statements of opinion and not statements of fact. No warranty, expressed or implied, as to the accuracy, timeliness, completeness, merchantability or fitness for any particular purpose of any such recommendation or information is given or made by emuse technologies in any form or manner whatsoever. |
|
From: Rajeev K. <Ra...@cu...> - 2003-11-20 02:08:16
|
Dmitry, Nice! A clever workaround. Thanks for your suggestion. regards, Rajeev ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: "'Rajeev Kaul '" <Ra...@cu...>; <spr...@li...> Sent: Wednesday, November 19, 2003 5:16 PM Subject: RE: [Springframework-developer] AutoProxyCreator problem > As to your first problem, you would need to create a new instance of the > BeanFactory > Consider the following piece of code (taken from > EnterpriseServices.createInvokerInterceptor() ): > > // Infinite cycle: tries to create the bean if we don't use a different > factory > ListableBeanFactoryImpl bf2 = new ListableBeanFactoryImpl(); > bf2.registerBeanDefinition(beanName, definition); > cpii.setBeanFactory(bf2); > > ...where cpii is the reference of type AbstractPoolingInvokerInterceptor > which extends PrototypeInvokerInterceptor > > I guess this is what you need. > > Dmitriy. > > -----Original Message----- > From: Rajeev Kaul > To: spr...@li... > Sent: 11/19/2003 7:33 PM > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > I am thinking of a solution for condensing the verbose configuration > (shown below) for prototype business logic beans I am using in my > application. A shared controller instance (singelton) creates the > business logic bean. However the business logic bean must be > instantiated per each thread that runs through the shared controller. I > have been using the configuration shown below: > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> > > <property name="count"><value>10</value></property> > > </bean> > > <bean id="prototypeInvokerInterceptor" > class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor"> > > > <property name="targetBeanName"><value>prototypeBean</value></property> > > </bean> > > <bean id="prototype" > class="org.springframework.aop.framework.ProxyFactoryBean"> > > <property > name="interceptorNames"><value>prototypeInvokerInterceptor</value></prop > erty> > > </bean> > > > > As you can see this is very verbose, especially if you have a lot of > these business logic beans in your application. I tried using a derived > version of BeanNameAutoProxyCreator to solve this, but ran into > problems. I would like to replace this configuration with something > shown below: > > > > <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" > proxy="prototype"> > > <property name="count"><value>10</value></property> > > </bean> > > This would involve adding a "PROXY" attribute which would specify the > type of proxy interceptor desired for the bean. For example, > "prototype" would mean ProxyFactoryBean with > PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with > InvokerInterceptor, etc. In loadBeanDefinition() method of the > XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean > and PrototypeInvokerInterceptor) could be automatically generated and > registered. > > Any suggestions, comments, ...? > > > > Rajeev > > ----- Original Message ----- > From: Rajeev Kaul <mailto:Ra...@cu...> > To: spr...@li... > <mailto:spr...@li...> > Sent: Tuesday, November 18, 2003 1:29 PM > Subject: [Springframework-developer] AutoProxyCreator problem > > > I have been trying to use BeanNameAutoProxyCreator class (I noticed > there are no test cases for it) to create proxies for "prototype" > business objects. I extended the BeanNameAutoProxyCreator class to use > the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" > method. However, this results in an infinite loop, as the > PrototypeInvokerInterceptor calls the beanFactory getBean() method which > in turn triggers the beanPostProcessor and the cycle repeats endlessly. > > Any suggestions on getting around this problem? > > It would have been better, if the BeanNameAutoProxyCreator class was > designed to take invokerInterceptor as a property, which could be > specified in the configuration, instead of having to subclass it to use > other invokerInterceptor(s). > > Rajeev Kaul > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-20 01:19:24
|
Everyone, I've added convenient class called RegexpMethodPointcutAroundAdvisor which makes it easier to define RegexpMethodPointcuts and associate them with Interceptors. Regards, Dmitriy. |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-20 01:17:25
|
As to your first problem, you would need to create a new instance of the BeanFactory Consider the following piece of code (taken from EnterpriseServices.createInvokerInterceptor() ): // Infinite cycle: tries to create the bean if we don't use a different factory ListableBeanFactoryImpl bf2 = new ListableBeanFactoryImpl(); bf2.registerBeanDefinition(beanName, definition); cpii.setBeanFactory(bf2); ...where cpii is the reference of type AbstractPoolingInvokerInterceptor which extends PrototypeInvokerInterceptor I guess this is what you need. Dmitriy. -----Original Message----- From: Rajeev Kaul To: spr...@li... Sent: 11/19/2003 7:33 PM Subject: Re: [Springframework-developer] AutoProxyCreator problem I am thinking of a solution for condensing the verbose configuration (shown below) for prototype business logic beans I am using in my application. A shared controller instance (singelton) creates the business logic bean. However the business logic bean must be instantiated per each thread that runs through the shared controller. I have been using the configuration shown below: <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> <property name="count"><value>10</value></property> </bean> <bean id="prototypeInvokerInterceptor" class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor"> <property name="targetBeanName"><value>prototypeBean</value></property> </bean> <bean id="prototype" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="interceptorNames"><value>prototypeInvokerInterceptor</value></prop erty> </bean> As you can see this is very verbose, especially if you have a lot of these business logic beans in your application. I tried using a derived version of BeanNameAutoProxyCreator to solve this, but ran into problems. I would like to replace this configuration with something shown below: <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" proxy="prototype"> <property name="count"><value>10</value></property> </bean> This would involve adding a "PROXY" attribute which would specify the type of proxy interceptor desired for the bean. For example, "prototype" would mean ProxyFactoryBean with PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with InvokerInterceptor, etc. In loadBeanDefinition() method of the XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean and PrototypeInvokerInterceptor) could be automatically generated and registered. Any suggestions, comments, ...? Rajeev ----- Original Message ----- From: Rajeev Kaul <mailto:Ra...@cu...> To: spr...@li... <mailto:spr...@li...> Sent: Tuesday, November 18, 2003 1:29 PM Subject: [Springframework-developer] AutoProxyCreator problem I have been trying to use BeanNameAutoProxyCreator class (I noticed there are no test cases for it) to create proxies for "prototype" business objects. I extended the BeanNameAutoProxyCreator class to use the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" method. However, this results in an infinite loop, as the PrototypeInvokerInterceptor calls the beanFactory getBean() method which in turn triggers the beanPostProcessor and the cycle repeats endlessly. Any suggestions on getting around this problem? It would have been better, if the BeanNameAutoProxyCreator class was designed to take invokerInterceptor as a property, which could be specified in the configuration, instead of having to subclass it to use other invokerInterceptor(s). Rajeev Kaul |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-20 00:59:45
|
I guess this could also be solved with source-level metadata and 'enterpriseservices' aouto proxy creation mechanism. Anyone, comments? Dmitriy. -----Original Message----- From: Rajeev Kaul To: spr...@li... Sent: 11/19/2003 7:33 PM Subject: Re: [Springframework-developer] AutoProxyCreator problem I am thinking of a solution for condensing the verbose configuration (shown below) for prototype business logic beans I am using in my application. A shared controller instance (singelton) creates the business logic bean. However the business logic bean must be instantiated per each thread that runs through the shared controller. I have been using the configuration shown below: <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false"> <property name="count"><value>10</value></property> </bean> <bean id="prototypeInvokerInterceptor" class="org.springframework.aop.interceptor.PrototypeInvokerInterceptor"> <property name="targetBeanName"><value>prototypeBean</value></property> </bean> <bean id="prototype" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="interceptorNames"><value>prototypeInvokerInterceptor</value></prop erty> </bean> As you can see this is very verbose, especially if you have a lot of these business logic beans in your application. I tried using a derived version of BeanNameAutoProxyCreator to solve this, but ran into problems. I would like to replace this configuration with something shown below: <bean id="prototypeBean" class="xyz.BusLogicBean" singleton="false" proxy="prototype"> <property name="count"><value>10</value></property> </bean> This would involve adding a "PROXY" attribute which would specify the type of proxy interceptor desired for the bean. For example, "prototype" would mean ProxyFactoryBean with PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with InvokerInterceptor, etc. In loadBeanDefinition() method of the XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean and PrototypeInvokerInterceptor) could be automatically generated and registered. Any suggestions, comments, ...? Rajeev ----- Original Message ----- From: Rajeev Kaul <mailto:Ra...@cu...> To: spr...@li... <mailto:spr...@li...> Sent: Tuesday, November 18, 2003 1:29 PM Subject: [Springframework-developer] AutoProxyCreator problem I have been trying to use BeanNameAutoProxyCreator class (I noticed there are no test cases for it) to create proxies for "prototype" business objects. I extended the BeanNameAutoProxyCreator class to use the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" method. However, this results in an infinite loop, as the PrototypeInvokerInterceptor calls the beanFactory getBean() method which in turn triggers the beanPostProcessor and the cycle repeats endlessly. Any suggestions on getting around this problem? It would have been better, if the BeanNameAutoProxyCreator class was designed to take invokerInterceptor as a property, which could be specified in the configuration, instead of having to subclass it to use other invokerInterceptor(s). Rajeev Kaul |
|
From: Rajeev K. <Ra...@cu...> - 2003-11-20 00:35:20
|
I am thinking of a solution for condensing the verbose configuration = (shown below) for prototype business logic beans I am using in my = application. A shared controller instance (singelton) creates the = business logic bean. However the business logic bean must be = instantiated per each thread that runs through the shared controller. I = have been using the configuration shown below: <bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" = singleton=3D"false">=20 <property name=3D"count"><value>10</value></property> </bean> <bean id=3D"prototypeInvokerInterceptor" = class=3D"org.springframework.aop.interceptor.PrototypeInvokerInterceptor"= >=20 <property = name=3D"targetBeanName"><value>prototypeBean</value></property> </bean> <bean id=3D"prototype" = class=3D"org.springframework.aop.framework.ProxyFactoryBean">=20 <property = name=3D"interceptorNames"><value>prototypeInvokerInterceptor</value></pro= perty> </bean> As you can see this is very verbose, especially if you have a lot of = these business logic beans in your application. I tried using a derived = version of BeanNameAutoProxyCreator to solve this, but ran into = problems. I would like to replace this configuration with something = shown below: <bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" = singleton=3D"false" proxy=3D"prototype">=20 <property name=3D"count"><value>10</value></property> </bean> This would involve adding a "PROXY" attribute which would specify the = type of proxy interceptor desired for the bean. For example, = "prototype" would mean ProxyFactoryBean with = PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean with = InvokerInterceptor, etc. In loadBeanDefinition() method of the = XmlBeanFactory class, the supporting proxy classes (ProxyFactoryBean = and PrototypeInvokerInterceptor) could be automatically generated and = registered. Any suggestions, comments, ...? Rajeev ----- Original Message -----=20 From: Rajeev Kaul=20 To: spr...@li...=20 Sent: Tuesday, November 18, 2003 1:29 PM Subject: [Springframework-developer] AutoProxyCreator problem I have been trying to use BeanNameAutoProxyCreator class (I noticed = there are no test cases for it) to create proxies for "prototype" = business objects. I extended the BeanNameAutoProxyCreator class to use = the PrototypeInvokerInterceptor in the "createInvokerInterceptor()" = method. However, this results in an infinite loop, as the = PrototypeInvokerInterceptor calls the beanFactory getBean() method which = in turn triggers the beanPostProcessor and the cycle repeats endlessly. Any suggestions on getting around this problem? It would have been better, if the BeanNameAutoProxyCreator class was = designed to take invokerInterceptor as a property, which could be = specified in the configuration, instead of having to subclass it to use = other invokerInterceptor(s).=20 Rajeev Kaul |
|
From: Rajeev K. <Ra...@cu...> - 2003-11-19 23:55:07
|
Why can't we use beanDefinitionMap.containsKey(beanName) in the ListableBeanFactoryImpl? ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: "'Rod Johnson '" <rod...@in...>; <spr...@li...> Sent: Wednesday, November 19, 2003 3:05 PM Subject: RE: [Springframework-developer] how to determine if a bean exists in registry? > I would say the impl. for such method would use > AbstractBeanFactory.getBeanDefinition(String) call, catch > NoSuchBeanDefinitionException and return false, otherwise return true. > > Dmitriy. > > -----Original Message----- > From: Rod Johnson > To: spr...@li... > Sent: 11/19/2003 5:15 PM > Subject: Re: [Springframework-developer] how to determine if a bean exists > in registry? > > >It would still make sense to add a containsBean method to BeanFactory, > I > guess, to avoid workarounds like isSingleton or getAliases checks. If > noone > objects, I'll do that - is that OK with you, Darren? Rod, what do you > think? > > This makes sense so long as the bean won't be instantiated by that call. > Otherwise getBean() with a catch block would work. > > R > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-19 23:49:11
|
To the list... -----Original Message----- From: j=FCrgen h=F6ller [werk3AT] To: Kopylenko, Dmitry; al...@jt...; Kopylenko, Dmitry; Rod Johnson; = Colin Sampaleanu; Trevor Cook; Thomas Risberg; dar...@hs...; = Luke Taylor; mpo...@sp...; Tony Falabella Sent: 11/19/2003 4:11 PM Subject: Re: Spring logical modules I like the idea of modules for documentation and marketing purposes = too, although we still need to discuss the naming, as we will have to stick with what we choose for quite a while. We shouldn't try to get too fine-granular, I guess. =20 Regarding validation: The validation.ObjectError class has a dependency on context.MessageSourceResolvable, therefore doesn't belong to core = but rather to context/container. =20 Regarding web MVC: I'd rather call this SpringWeb or something similar, as it isn't purely about web MVC but also offers a lot for use with other web frameworks. =20 Juergen =20 ________________________________ Von: Kopylenko, Dmitry [mailto:dko...@ac...] Gesendet: Mi 19.11.2003 19:11 An: 'al...@jt...'; Kopylenko, Dmitry; 'Rod Johnson'; j=FCrgen = h=F6ller [werk3AT]; 'Colin Sampaleanu'; 'Trevor Cook'; 'Thomas Risberg'; 'dar...@hs...'; 'Luke Taylor'; 'mpo...@sp...'; 'Tony Falabella' Betreff: RE: Spring logical modules So the logical modules names is a good idea. Ok. So validation could be part of SpringCore and remoting, jndi, mail, ejb part of SpringJ2EE =20 JIRA - I've got the open source license. Also Mike sent me an email = last week saying that they will install Spring instance on their server some time this week (they've upgraded to the latest version of 2.5) So if I don't hear from him by the end of this week, I'll contact him. We're almost there :-) =20 Dmitriy. -----Original Message----- From: Alef Arendsen (JTeam) [mailto:al...@jt...]=20 Sent: Wednesday, November 19, 2003 12:40 PM To: 'Kopylenko, Dmitry'; 'Rod Johnson'; 'j=FCrgen h=F6ller [werk3AT]'; 'Colin Sampaleanu'; 'Trevor Cook'; 'Thomas Risberg'; dar...@hs...; 'Luke Taylor'; mpo...@sp...; 'Tony Falabella' Subject: RE: Spring logical modules =09 =09 Sounds good.=20 =20 When creating the initial structure for the reference documentation (on which I hope to spend some time coming weekend), I = had almost the same structure except for the following: =20 SpringContainer split into beans and context (but it seems logical to see it as one) SpringDAO split into JDBC and ORM (idem) =20 Furtermore I had a separate chapter for validation (part of SpringCore??), email and remoting (but those being part of J2EE is fine with me). =20 How's the JIRA thing going by the way? =20 alef =20 -----Oorspronkelijk bericht----- Van: Kopylenko, Dmitry [mailto:dko...@ac...]=20 Verzonden: Wednesday, November 19, 2003 6:04 PM Aan: 'Rod Johnson (rod...@in...)'; 'j=FCrgen h=F6ller [werk3AT]'; 'Colin Sampaleanu'; 'Trevor Cook'; = 'Thomas Risberg'; 'al...@jt...'; 'dar...@hs...'; 'Luke Taylor'; 'mpo...@sp...'; 'Tony Falabella' Onderwerp: Spring logical modules =09 =09 Helo everyone,=20 Here is the proposal to use "logical" modules (just names) of the Spring framework grouped by functional area=20 analogous to JBoss's logical modules e.g. JBossMX, JBossNS, JBossTX etc. Then these module names could be used in documentation, marketing and as JIRA components.=20 Modules:=20 * SpringAOP (aop framework)=20 * SpringContainer (beans, context packages)=20 * SpringCore (core, util packages)=20 * SpringDAO (dao, jdbc, orm packages)=20 * SpringMVC (web packages)=20 * SpringTX (transaction infrastructure)=20 * SpringMetadata (metadata packages)=20 * SpringJ2EE (jndi, mail packages)=20 Anything else? Any comments/ideas?=20 Regards,=20 Dmitriy.=20 |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-19 23:06:03
|
I would say the impl. for such method would use AbstractBeanFactory.getBeanDefinition(String) call, catch NoSuchBeanDefinitionException and return false, otherwise return true. Dmitriy. -----Original Message----- From: Rod Johnson To: spr...@li... Sent: 11/19/2003 5:15 PM Subject: Re: [Springframework-developer] how to determine if a bean exists in registry? >It would still make sense to add a containsBean method to BeanFactory, I guess, to avoid workarounds like isSingleton or getAliases checks. If noone objects, I'll do that - is that OK with you, Darren? Rod, what do you think? This makes sense so long as the bean won't be instantiated by that call. Otherwise getBean() with a catch block would work. R ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Rod J. <rod...@in...> - 2003-11-19 22:53:46
|
>It would still make sense to add a containsBean method to BeanFactory, I guess, to avoid workarounds like isSingleton or getAliases checks. If noone objects, I'll do that - is that OK with you, Darren? Rod, what do you think? This makes sense so long as the bean won't be instantiated by that call. Otherwise getBean() with a catch block would work. R |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-19 22:26:33
|
I've commited it this morning. Could help the temptation ;-) Dmitriy. -----Original Message----- From: j=FCrgen h=F6ller [werk3AT] To: spr...@li... Sent: 11/19/2003 4:29 PM Subject: Re: [Springframework-developer] RedirectView +1 - and do it quickly, 1.0 M3 is just around the corner :-) =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag von Trevor Cook Gesendet: Mi 19.11.2003 22:30 An: spr...@li... Betreff: RE: [Springframework-developer] RedirectView +1 That's what I use (and what the jaf api recommends) =20 Trevor -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Kopylenko, Dmitry Sent: November 18, 2003 2:07 PM To: 'spr...@li...' Subject: [Springframework-developer] RedirectView =09 =09 Everyone,=20 In org.springframework.web.servlet.view.RedirectView=20 Line 71: url.append(URLEncoder.encode(entry.getKey().toString());=20 Line 73: url.append(URLEncoder.encode(entry.getValue().toString()));=20 URLEncoder.encode(String) is deprecated. Does anyone mind if I change it to url.append(URLEncoder.encode(entry.getKey().toString(), "UTF-8")) and url.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")) respectively ?=20 Regards,=20 Dmitriy.=20 ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: <jue...@we...> - 2003-11-19 21:32:18
|
+1 - and do it quickly, 1.0 M3 is just around the corner :-) =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Trevor Cook Gesendet: Mi 19.11.2003 22:30 An: spr...@li... Betreff: RE: [Springframework-developer] RedirectView +1 That's what I use (and what the jaf api recommends) =20 Trevor -----Original Message----- From: spr...@li... = [mailto:spr...@li...]On Behalf = Of Kopylenko, Dmitry Sent: November 18, 2003 2:07 PM To: 'spr...@li...' Subject: [Springframework-developer] RedirectView =09 =09 Everyone,=20 In org.springframework.web.servlet.view.RedirectView=20 Line 71: url.append(URLEncoder.encode(entry.getKey().toString());=20 Line 73: url.append(URLEncoder.encode(entry.getValue().toString()));=20 URLEncoder.encode(String) is deprecated. Does anyone mind if I change = it to url.append(URLEncoder.encode(entry.getKey().toString(), "UTF-8")) and url.append(URLEncoder.encode(entry.getValue().toString(), = "UTF-8")) respectively ?=20 Regards,=20 Dmitriy.=20 |
|
From: Trevor C. <pr...@se...> - 2003-11-19 21:30:00
|
RedirectView+1 That's what I use (and what the jaf api recommends) Trevor -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Kopylenko, Dmitry Sent: November 18, 2003 2:07 PM To: 'spr...@li...' Subject: [Springframework-developer] RedirectView Everyone, In org.springframework.web.servlet.view.RedirectView Line 71: url.append(URLEncoder.encode(entry.getKey().toString()); Line 73: url.append(URLEncoder.encode(entry.getValue().toString())); URLEncoder.encode(String) is deprecated. Does anyone mind if I change it to url.append(URLEncoder.encode(entry.getKey().toString(), "UTF-8")) and url.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")) respectively ? Regards, Dmitriy. |
|
From: <jue...@we...> - 2003-11-19 21:12:20
|
Why not use ListableBeanFactory's getBeanDefinitionNames method? If the = returned String array contains the bean name, then it is available in = the factory. =20 It would still make sense to add a containsBean method to BeanFactory, I = guess, to avoid workarounds like isSingleton or getAliases checks. If = noone objects, I'll do that - is that OK with you, Darren? Rod, what do = you think? =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Kopylenko, Dmitry Gesendet: Mi 19.11.2003 21:46 An: 'spr...@li...' Betreff: RE: [Springframework-developer] how to determine if a bean = exists in registry? If there is a big demand for such a "query" method I could add it to = BeanFactory or AbstractBeanFactory. What everybody thinks? =20 Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...]=20 Sent: Wednesday, November 19, 2003 3:42 PM To: spr...@li... Subject: Re: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Although, I would still prefer a simpler method that just returns a = boolean, but your solution will work for me. =20 Thanks!!!! =20 =20 ----- Original Message -----=20 From: Dmitriy Kopylenko <mailto:dko...@ru...> =20 To: spr...@li...=20 Sent: Wednesday, November 19, 2003 11:15 AM Subject: RE: [Springframework-developer] how to determine if a bean = exists in registry? Or better yet use AbstractBeanFactory.getBeanDefinition(String = beanName) which would throw NoSuchBeanDefinitionException if bean does = not exist. =20 Regards, Dmitriy. -----Original Message----- From: spr...@li... = [mailto:spr...@li...] On Behalf = Of Kopylenko, Dmitry Sent: Wednesday, November 19, 2003 2:08 PM To: 'spr...@li...' Subject: RE: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Rajeev, =20 you could use String[] getAliases(String name) throws = NoSuchBeanDefinitionException in BeanFactory and catch = NoSuchBeanDefinitionException. If caught, then bean does not exist in = the factory. =20 Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...]=20 Sent: Wednesday, November 19, 2003 1:54 PM To: spr...@li... Subject: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Is there an easy way to determine if a certain bean exists in the = beanFactory? I know one can use the getBean(name) to determine that, = but it seems an expensive call, especially, if there are bean post = processors associated with it. Don't you think having a function like = boolean containsBean(String beanName) in a beanFactory class would be = useful here? =20 Rajeev Kaul =09 |
|
From: Kopylenko, D. <dko...@ac...> - 2003-11-19 20:46:51
|
If there is a big demand for such a "query" method I could add it to BeanFactory or AbstractBeanFactory. What everybody thinks? Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Wednesday, November 19, 2003 3:42 PM To: spr...@li... Subject: Re: [Springframework-developer] how to determine if a bean exists in registry? Although, I would still prefer a simpler method that just returns a boolean, but your solution will work for me. Thanks!!!! ----- Original Message ----- From: Dmitriy <mailto:dko...@ru...> Kopylenko To: spr...@li... <mailto:spr...@li...> Sent: Wednesday, November 19, 2003 11:15 AM Subject: RE: [Springframework-developer] how to determine if a bean exists in registry? Or better yet use AbstractBeanFactory.getBeanDefinition(String beanName) which would throw NoSuchBeanDefinitionException if bean does not exist. Regards, Dmitriy. -----Original Message----- From: spr...@li... <mailto:spr...@li...> [mailto:spr...@li...] On Behalf Of Kopylenko, Dmitry Sent: Wednesday, November 19, 2003 2:08 PM To: 'spr...@li...' Subject: RE: [Springframework-developer] how to determine if a bean exists in registry? Rajeev, you could use String[] getAliases(String name) throws NoSuchBeanDefinitionException in BeanFactory and catch NoSuchBeanDefinitionException. If caught, then bean does not exist in the factory. Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Wednesday, November 19, 2003 1:54 PM To: spr...@li... Subject: [Springframework-developer] how to determine if a bean exists in registry? Is there an easy way to determine if a certain bean exists in the beanFactory? I know one can use the getBean(name) to determine that, but it seems an expensive call, especially, if there are bean post processors associated with it. Don't you think having a function like boolean containsBean(String beanName) in a beanFactory class would be useful here? Rajeev Kaul |