Is there a way to use an Enum value in a RequestMapping?
@RequestMapping(value = "/example",
method = RequestMethod.POST)
public final void foo(final HttpServletResponse response,
I want to use a URL value that is already stored in an Enum.
However, I get compile time errors when I try to put anything except a String literal in the RequestMapping
.
How does it know the difference between a String literal and a String that is not a String literal ( not sure what that's called ) ?
This is what I tried but it failed at compile time:
@RequestMapping(value = FooEnum.Example.getStringValue(),
method = RequestMethod.POST)
public final void foo(final HttpServletResponse response,
I also tried using String.format
but it doesn't like that either:
@RequestMapping(value = String.format("%s", FooEnum.Example.getStringValue()),
method = RequestMethod.POST)
public final void foo(final HttpServletResponse response,