Announcement Announcement Module
Collapse
No announcement yet.
get xml file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • get xml file

    anyone knows how to get the xml file path/name of the ApplicationContext? it's passed as command line argument in Spring Batch and i'd like to retrieve it from an object or maybe a system property?

    Thanks!!

  • #2
    The best I've found so far is:

    Code:
    System.getProperty("exec.args")
    but i was hoping for a more Spring-y solution. Besides, this does not work when the job is started via Spring Batch Admin (I'm not sure what's being used to start the job when using it)

    Any suggestions?

    Comment


    • #3
      When running my job, the logs on Spring Batch Admin (using Jetty) show the following message:

      ResourceXmlApplicationContext:file:/home/anthony/maven/spring-batch-admin-sample/target/classes/META-INF/spring/batch/jobs/my_job.xml

      It'd be nice if I could access that programmatically..!

      Comment


      • #4
        Can you set the property in a properties file and identify a path for various locations that you will need??

        Comment


        • #5
          may I ask why you need such information?

          Comment


          • #6
            satsranchuser: I thought about it, I was just hoping to obtain it from an object instead. based on the logs, it clearly is stored somewhere

            arno: not sure i'll need it yet, but i'm considering creating another xml job file for the next run, based on information gathered on the current run. It may be as simple as changing one parameter, hence I'd like to be able to access the current xml to use as template.

            Comment


            • #7
              I see. Perhaps you should do that outside the application context, not from inside. It would make more sense to me.

              Comment


              • #8
                ok, well if you guys can't think of an obvious way to obtain it anyway, I suppose I can simply go with satsranchuser's suggestion.

                Comment

                Working...
                X