PDA

View Full Version : Exclude option for ObjectNameAutoProxyCreator


Nop
03-06-2007, 06:16 AM
Hi.
I am going to use ObjectNameAutoProxyCreator.
Is it possible to specify a list of excluded objects from ObjectNames?

Thanks.

Bruno Baia
03-06-2007, 11:02 AM
Hi,

You can't do this with ObjectNameAutoProxyCreator, but you can easily create your own AutoProxyCreator.
For that you just need to inherit from AbstractAutoProxyCreator like ObjectNameAutoProxyCreator does.


Bruno

Nop
03-06-2007, 12:37 PM
Bruno Baia, thanks for your reply. I'll do as you adviced.
But I have some questions:

1) I try to use ObjectNameAutoProxyCreator (like Aop example) and DefaultAdvisorAutoProxyCreator (like Dao example) in the same context. I am reported about an exception:
[ObjectCreationException: Error creating object with name 'AuthService' defined in 'file [C:\development\projects\MyProj\trunk\Src\Web\Confi g\Services.xml]' : Initialization of object failed : 'RollbackFor' property specified was not found.]
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) in j:\release\Spring.Net\src\Spring\Spring.Core\Objec ts\Factory\Support\AbstractAutowireCapableObjectFa ctory.cs:777
Spring.Objects.Factory.Support.WebObjectFactory.Cr eateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments) in j:\release\Spring.Net\src\Spring\Spring.Web\Core\O bjects\Factory\Support\WebObjectFactory.cs:221

My object AuthService is PONO, and is declared with Transaction attribute. Thus, AuthService is used in both aspects.
I could not understand how is 'RollbackFor' property appeared. I suppose it is because of AOP proxy created for AuthService.
As soon as, I comment Dao, it works fine. There is a statement in the documentation that any object can take part in any number of aspects. Is it true? If true, what do I do wrong?

2) Is it necessary to define names for ObjectNameAutoProxyCreator objects? Do present any rules for proxy naming?

Bruno Baia
03-06-2007, 01:08 PM
1)
This is a bug and has been fixed in december just after 1.1 Preview 3.
I guess you are using 1.1 P3, so you will need to get one of the latest nightly build (http://www.springframework.net/downloads/nightly/).

2)
You can if you want, but if you don't, Spring will generate unique IDs ( ObjectNameAutoProxyCreator#1, ObjectNameAutoProxyCreator#2, etc...)


Cheers,
Bruno

Nop
03-06-2007, 01:38 PM
Thanks.
You are right. I am using 1.1. P3.
I will update spring libs as you adviced.

Best regards.