on ‎2018 Jan 31 12:11 PM
Hi,
I am trying to associate configuration values to the bean during initialization. The runtimeConfig is a service class that looks up the input parameter from DB. Saw some examples in google that the below approach is possible. However, I am getting the below exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mqQueueConnectionFactory' defined in class path resource [orrpocintegration-messaging-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is java.lang.NullPointerException
My Spring Configuration:
where
<bean name="defaultRuntimeConfigurationService" class="com.prasun.integration.runtime.service.impl.DefaultRuntimeConfigurationService" />
Need help. Thanks.
Request clarification before answering.
My hybris is running on a cluster 6 nodes and I would need to change the configuration at runtime depending on situation. App Node hAC is not accessible. Hence, I am planning to use DB based configuration rather than using local.properties.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But that wouldn't work with your original config anyway. The properties aren't live they are just fed in at configuration time.
I'm not familiar with a Spring 'runtimeConfig' and can't find any documentation on it. How would it work? Is it wrapping the bean in a proxy that intercepts the getters? It's not at all clear from your example how this is supposed to work.
Perhaps something with a ConfigChangeListener and a ClusterAwareEvent to broadcast those changes would work for you?
You don't seem to have declared a runtimeConfig bean. Why not use the more Hybris-y ConfigurationService ? Then it'll pick up the values from your local.properties file.
e.g.
<bean id="qohMQConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<bean id="mqQueueConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"
p:transportType="#{configurationService.configuration.getString('qoh.mq.transport-type')}"
p:queueManager="#{configurationService.configuration.getString('qoh.mq.queue-manager')}"
p:channel="#{configurationService.configuration.getString('qoh.mq.channel')}"
p:hostName="#{configurationService.configuration.getString('qoh.mq.host')}"
p:port="#{configurationService.configuration.getString('qoh.mq.port')}"
p:clientReconnectTimeout="#{configurationService.configuration.getString('qoh.mq.connection.retry.timeout')}"/>
</property>
</bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.