Localization with Spring 2.5


In Spring 2.5 you can tell in your dispatcher servlet configuration to scan for @Controller annotations. That way you don’t configure URL mappings explicity in the dispacher servlet as you used to do before since the annotations are added to the controller classes themselves. It’s less XML and I really like it. However I did not know how to add the locale interceptor in this case, because  there was no urlMapping bean defined. I found out online you just need to add the following configuration to the dispatcher servlet.

<bean     class=”org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping”>
<property name=”interceptors” ref=”localeChangeInterceptor” />


Hope this helps you too.

One thought on “Localization with Spring 2.5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s