I have a spring boot 2.3.x application with dynamic properties and have loaded them using @PropertySource. The application is able to get the property values using @Autowired Environment getProperty() method and this works fine with Tomcat
custom_config.properties
system_abc=1
system_def=1
system_xyz=5
Code Snippet
@Component
public class SystemResolver {
@Autowired
private Environment env;
public String getSystemValue(final String sysId) {
return env.getProperty("system_" + sysId);
}
The problem I am facing is when trying to run the application in JBoss EAP 7.x, @Autowired Environment getProperty() method returns org.jboss.as.naming.NamingContext instead of java.lang.String
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.jboss.as.naming.NamingContext] to type [java.lang.String]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174)
at org.springframework.core.env.AbstractPropertyResolver.convertValueIfNecessary(AbstractPropertyResolver.java:265)
at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:91)
at org.springframework.core.env.PropertySoutrcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:62)
at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:535)
I tried excluding the JBoss submodule 'naming' from my standalone.xml, however it threw issues on application startup
Please share some inputs as how to overcome this behavior in JBoss EAP 7.x