Is there a way to use the Enum value in 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 Enum.
However, I get compile-time errors when I try to put anything other than a string literal in RequestMapping.
How does he know the difference between a string literal and a string that is not a string literal (not sure what is 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 I also don't like this:
@RequestMapping(value = String.format("%s", FooEnum.Example.getStringValue()),
method = RequestMethod.POST)
public final void foo(final HttpServletResponse response,
source
share