Fix placeholder in JmsChannelParser for cache

Looks like spring JMS does not uppercase the `cacheLevelName` before assigning
anymore.

* Remove `toUpperCase()` for `cache` in the `JmsChannelParser` logic.
* Perform `toUpperCase()` in the `JmsChannelFactoryBean.setCacheLevelName()` instead
This commit is contained in:
abilan
2023-07-17 11:07:24 -04:00
parent 20d5f628bc
commit f527025256
2 changed files with 9 additions and 6 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.
@@ -203,9 +203,10 @@ public class JmsChannelFactoryBean extends AbstractFactoryBean<AbstractJmsChanne
}
public void setCacheLevelName(String cacheLevelName) {
Assert.hasText(cacheLevelName, "The 'cacheLevelName' must not be empty");
Assert.isTrue(this.messageDriven, "'cacheLevelName' is allowed only in case of 'messageDriven = true'");
Assert.state(this.cacheLevel == null, "'cacheLevelName' and 'cacheLevel' are mutually exclusive");
this.cacheLevelName = cacheLevelName;
this.cacheLevelName = cacheLevelName.toUpperCase();
}
public void setCacheLevel(Integer cacheLevel) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 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.
@@ -23,6 +23,8 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractChannelParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.listener.SimpleMessageListenerContainer;
import org.springframework.util.StringUtils;
/**
@@ -119,10 +121,10 @@ public class JmsChannelParser extends AbstractChannelParser {
String containerClass = element.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
if (!StringUtils.hasText(containerClass) && StringUtils.hasText(containerType)) {
if ("default".equals(containerType)) {
containerClass = "org.springframework.jms.listener.DefaultMessageListenerContainer";
containerClass = DefaultMessageListenerContainer.class.getName();
}
else if ("simple".equals(containerType)) {
containerClass = "org.springframework.jms.listener.SimpleMessageListenerContainer";
containerClass = SimpleMessageListenerContainer.class.getName();
}
}
/*
@@ -151,7 +153,7 @@ public class JmsChannelParser extends AbstractChannelParser {
}
}
else {
builder.addPropertyValue("cacheLevelName", "CACHE_" + cache.toUpperCase());
builder.addPropertyValue("cacheLevelName", "CACHE_" + cache);
}
}
}