开发者

Spring beans based on properties

开发者 https://www.devze.com 2023-02-21 01:41 出处:网络
I am wondering if the below is possible in Spring Read a property file using spring - this file has a list of jms queue names

I am wondering if the below is possible in Spring

  1. Read a property file using spring - this file has a list of jms queue names
  2. Make spring loop on the above list and define beans that define Apache camel routes from that queue to a file

I could just create the routes using java code on the apache camel context, but wondering if it is possible through spring. 开发者_运维技巧


Reading a property file in a Spring XML wiring file is easy; e.g. using a PropertiesFactoryBean. However, the second part of the problem cannot (I believe) be solved without writing a significant amount of Java code.

I suggest that you read Section 3.8.3 of the Spring Reference that describes how to write your own FactoryBean classes. Another possibility is to create a custom Java configuration bean as described in Section 3.11. There may be other possibilities too.

Warning: none of this stuff is particularly straight-forward if you are coming at it for the first time.

0

精彩评论

暂无评论...
验证码 换一张
取 消