Announcement Announcement Module
Collapse
No announcement yet.
Spring batch admin - set locale Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring batch admin - set locale

    Hi all.

    I'd like to set the correct locale (pt_BR) in order to see the dates correctly.

    According to this issue (https://jira.springsource.org/browse/BATCHADM-29):

    Dave Syer added a comment - 03/Mar/10 10:08 PM

    Parameterized time zone in the controllers (defaults to VM locale). User can override by adding a bean definition called "userTimeZone" to servlet application context.
    But how can I do that? How do I register this bean? Can anyone give me an example?

    Thanks.

  • #2
    Give this a try:

    Code:
    <bean id="userTimeZone" class="java.util.TimeZone" factory-method="getTimeZone">
        <constructor-arg>America/Los_Angeles</constructor-arg>
    </bean>

    Comment


    • #3
      Hi, thanks for your reply!

      I'm not sure where I should do this.

      1) META-INF/servlet/service-context.xml ?
      2) META-INF/spring/batch/override/app-context.xml?

      Thanks!

      Comment


      • #4
        Well, I've tried at META-INF/spring/batch/servlet/override/app-context.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

        <bean id="userTimeZone" class="java.util.TimeZone" factory-method="getTimeZone">
        <constructor-arg value="America/Sao_Paulo" />
        </bean>

        </beans>

        But it did not solve my problem... any clue?

        Comment


        • #5
          Put it in META-INF/spring/batch/override/app-context.xml.

          Comment


          • #6
            Originally posted by mminella View Post
            Put it in META-INF/spring/batch/override/app-context.xml.
            Hi! Thanks for the reply.

            I did it, but it does not work...

            At admin, I see

            929 889 sBatchRenewJob 2012-10-09 20:29:12 00:00:08 COMPLETED COMPLETED

            and at database, I see

            929 2012-10-09 17:29:12.36

            Any clue?

            Comment


            • #7
              Then it is working correctly. The translation occurs in the UI and has no impact on the database. What is the issue you are trying to solve?

              Comment


              • #8
                No, it isn't. The correct time is 17:29:12.36, which comes from the database. The UI is translating to 20:29:12, which is wrong.

                I want the UI to translate it correctly...

                Comment


                • #9
                  So in that case, the UI is translating it and you don't wan it to...In that case, set that time bean to be GMT (the UI is assuming GMT is stored, which in this case, it's not).

                  Comment


                  • #10
                    Originally posted by mminella View Post
                    So in that case, the UI is translating it and you don't wan it to...In that case, set that time bean to be GMT (the UI is assuming GMT is stored, which in this case, it's not).
                    That's a good point.

                    How can I set that bean to be GMT?

                    Comment


                    • #11
                      Code:
                      <bean id="userTimeZone" class="java.util.TimeZone" factory-method="getTimeZone">
                          	<constructor-arg value="GMT" />
                      	</bean>
                      It still does not work

                      Comment


                      • #12
                        any thoughts on this?

                        Comment

                        Working...
                        X