Restore outdated local/remote-slsb attributes for declaration compatibility

Legacy EJB attributes are ignored since 6.0 due to being bound to a plain JndiObjectFactoryBean - but can still be declared now, e.g. when validating against the common versions of spring-jee.xsd out there.

Closes gh-31627
This commit is contained in:
Juergen Hoeller
2023-11-20 21:01:36 +01:00
parent 54f87f1ff7
commit 695559879e
5 changed files with 163 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@ package org.springframework.ejb.config;
import org.w3c.dom.Element;
import org.springframework.beans.BeanUtils;
import org.springframework.jndi.JndiObjectFactoryBean;
/**
* {@link org.springframework.beans.factory.xml.BeanDefinitionParser}
* implementation for parsing '{@code local-slsb}' tags and
* creating plain {@link JndiObjectFactoryBean} definitions.
* creating plain {@link JndiObjectFactoryBean} definitions on 6.0.
*
* @author Rob Harrop
* @author Juergen Hoeller
@@ -36,4 +37,10 @@ class LocalStatelessSessionBeanDefinitionParser extends AbstractJndiLocatingBean
return JndiObjectFactoryBean.class;
}
@Override
protected boolean isEligibleAttribute(String attributeName) {
return (super.isEligibleAttribute(attributeName) &&
BeanUtils.getPropertyDescriptor(JndiObjectFactoryBean.class, extractPropertyName(attributeName)) != null);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,13 @@ package org.springframework.ejb.config;
import org.w3c.dom.Element;
import org.springframework.beans.BeanUtils;
import org.springframework.jndi.JndiObjectFactoryBean;
/**
* {@link org.springframework.beans.factory.xml.BeanDefinitionParser}
* implementation for parsing '{@code remote-slsb}' tags and
* creating plain {@link JndiObjectFactoryBean} definitions.
* creating plain {@link JndiObjectFactoryBean} definitions as of 6.0.
*
* @author Rob Harrop
* @author Juergen Hoeller
@@ -36,4 +37,10 @@ class RemoteStatelessSessionBeanDefinitionParser extends AbstractJndiLocatingBea
return JndiObjectFactoryBean.class;
}
@Override
protected boolean isEligibleAttribute(String attributeName) {
return (super.isEligibleAttribute(attributeName) &&
BeanUtils.getPropertyDescriptor(JndiObjectFactoryBean.class, extractPropertyName(attributeName)) != null);
}
}