Spring "Integrating Data" Getting started guide - using variables in the integration.xml file -
I have worked through the guide on the Spring website and trying to determine how the configuration settings (the replacement ) In the integration.xml
file instead of the hard codes, instead of the different items. This is primarily driven by the desire to exterminate some configuration from XML and takes advantage of the ability to allow for the outer system of Spring Boot.
I am trying to determine the solution for some time, thinking that this is a simple answer (for those who know how to know).
In the snippet given below (taken from the guide) I have used the $ {outputDir}
as a placeholder for the configuration item, I will pass in the application:
& lt; File: Outbound-channel-adapter id = "file" mode = "APPEND" charset = "UTF-8" directory = "$ {outputDir}" file name-generator-expression = "helloword" />
Basically, I'm trying to determine what I need to do to get the $ {outputDir}
replacement job.
I have lowered the following code to work through the problem as part:
-
integration.xml
just oneThe file can be copied from the file: In the inbound-channel-adapter
directory, thefile: outbound-channel-adapter
directory -
application
class uses spring boot, which is loaded into the demo installation instances in that field Is he whom I want to change theintegration.xml
at runtime.
Until I'm not mistaken (when I get to do this work), I get the inputDir
and outputDir
items Integration.xml
should be able to override
Your integration.xml
reference $ {inputDir}
, which is not there.
To work with existing config, just type application.properties
in your class to inputDir = / Tmp / in
and outputDir
. This way it matches the config file from your used wars.
If you want to be with your naming, change the XML to use $ {demo.inputDir}
. These are the names you are using in your existing application.properties
.
And if you want to paste in your @configurationProperties
, you can access the beam in # {demoConfigration.inputDir}
in XML, where your Please note that your code currently fails (at least for me) because you basically define the bean twice (per @EnableConfigurationProperties
and once the @ ComponentScan + Component
on config)
Comments
Post a Comment