History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-297
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Dan Diephouse
Reporter: Flier Lu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

Jsr181HandlerMapping may force spring to create abstract bean

Created: 10/Mar/06 01:16 AM   Updated: 15/Mar/06 09:49 AM
Component/s: Spring
Affects Version/s: 1.0
Fix Version/s: 1.1-beta-1

Time Tracking:
Not Specified

Environment: JDK1.4, Spring 1.2.6


 Description  « Hide
when Jsr181HandlerMapping.processBeans() called, it will iterate all the bean in app context

private void processBeans(ApplicationContext beanFactory, AnnotationServiceFactory serviceFactory)
{
String[] beanNames = beanFactory.getBeanDefinitionNames();

// Take any bean name or alias that has a web service annotation
for (int i = 0; i < beanNames.length; i++)
{
if (!beanFactory.isSingleton(beanNames[i])) continue;

Class clazz;
Object bean;
try
{
clazz = getApplicationContext().getType(beanNames[i]);
bean = beanFactory.getBean(beanNames[i]);

but if a abstract bean in context, beanFactory.getBean may force spring create abstract bean, and raise a BeanIsAbstractException error.

org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'abstractTxDefinition': Bean definition is abstract

so we must check the bean definition first, like this

ConfigurableApplicationContext.getBeanFactory().getBeanDefinition().isAbstract()

maybe we also need to add a service adapter to process lazy init bean.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Flier Lu - 10/Mar/06 03:34 AM
working code

private void processBeans(ApplicationContext beanFactory, AnnotationServiceFactory serviceFactory)
{
String[] beanNames = beanFactory.getBeanDefinitionNames();

ConfigurableApplicationContext ctxt = (ConfigurableApplicationContext) beanFactory;

// Take any bean name or alias that has a web service annotation
for (int i = 0; i < beanNames.length; i++)
{
BeanDefinition def = ctxt.getBeanFactory().getBeanDefinition(beanNames[i]);

if (!def.isSingleton() || def.isAbstract()) continue;


Dan Diephouse - 12/Mar/06 10:42 AM
Thanks, we'll get this fixed.

Dan Diephouse - 15/Mar/06 09:49 AM
Fixed in SVN now. Thanks!