|
From: Rod J. <rod...@in...> - 2003-10-30 16:36:21
|
Juergen, I basically agree with your points. > So as a summary, I propose the following changes: > 1. "default-dependency-check" and "default-autowire" (already done but not committed yet) Yes. > 2. ignore certain dependency types for autowiring, BeanFactory and ApplicationContext in particular (done too) Yes. > 3. explicitly document optional object dependencies in framework beans to ease dependency check settings We may be able to do better than rely on docs. Some kind of metadata could be provided to autowiring specifying what's optional and what's not. This might make sense for framework components. Options: 1. Attach metadata attributes to properties with something like @OptionalProperty. We could compile this metadata in with Spring if our metadata support came on far enough so that our runtime information would find it. If there was no available metadata it would just assume that all properties were optional or required. This would have the advantage of defining a powerful way for users to specify whether or not their properties were required. 2. Add BeanInfo like classes (checking whether there are any features we can use from the JavaBeans BeanInfo stuff, which I think was painful to use) 3. Use XML or properties metadata packaged along with the classes. > 4. redefine autowiring to not complain if no matching bean found (promote additional "objects" dependency check as an option) Yes. > 5. introduce a ListableBeanFactory.getBeansOfType(Class type) method and build autowire-by-type on it Yes, a getBeansOfType() method would be useful. And the FactoryBean type issue is overdue for clarification. Should the FactoryBean have a getType() method on it, to return null if it can't know (as with JNDI)? Or a subinterface, TypedFactoryBean? This would enable most factory beans to work with getBeanNamesOfType() as well. Of course even with JNDI the user could specify a type like javax.sql.DataSource and it would give the FactoryBean a way of checking that the value in finds in JNDI makes sense. Regards, Rod |