DATAJPA-813 - Made JNDI EntityManagerFactory detection more lenient.
We now don't assume an expectedType property configured for every declaration of <jee:jndi-lookup /> but rather skip elements that don't have the attribute configured.
This commit is contained in:
@@ -124,7 +124,7 @@ public class BeanDefinitionUtils {
|
||||
BeanDefinition definition = beanFactory.getBeanDefinition(name);
|
||||
|
||||
if (JNDI_OBJECT_FACTORY_BEAN.equals(definition.getBeanClassName())) {
|
||||
if (!definition.getPropertyValues().get("expectedType").equals(EntityManagerFactory.class.getName())) {
|
||||
if (!EntityManagerFactory.class.getName().equals(definition.getPropertyValues().get("expectedType"))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ public class DefaultJpaContextIntegrationTests {
|
||||
|
||||
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
|
||||
builder.bind("some/EMF", createEntityManagerFactory("spring-data-jpa"));
|
||||
builder.bind("some/other/Component", new Object());
|
||||
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("config/jpa-context-with-jndi.xml");
|
||||
ApplicationComponent component = context.getBean(ApplicationComponent.class);
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
<jee:jndi-lookup id="entityManagerFactory"
|
||||
jndi-name="some/EMF"
|
||||
expected-type="javax.persistence.EntityManagerFactory" />
|
||||
|
||||
|
||||
<jee:jndi-lookup id="someOtherJndiBean"
|
||||
jndi-name="some/other/Component" />
|
||||
|
||||
<bean class="org.springframework.data.jpa.repository.support.DefaultJpaContextIntegrationTests$ApplicationComponent" autowire="constructor" />
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user