Assuming we're talking about RequestMappings paths, etc. In my application, I have one class with public static final constant binding, which I refer to in the @RequestMapping annotation.
So constants might look like this:
public class Pages { public static final String FOO_URL "foo/foo.action" public static final String FOO_VIEW "test/foo" public static final String BAR_URL "bar/bar.action" public static final String BAR_VIEW "test/bar" }
then inside your controller you will refer to them as follows:
@RequestMapping(value=Pages.FOO_URL, method=RequestMethod.GET) public String handleFoo(Model model) { return Pages.FOO_VIEW; }
They are easy to change because they are all in one place.
source share