initialize the variable in the annotation it self
Hi i have a requirement to generate a code like this @RequestMapping(value = {"/user"}) but it is throwing exception as a temporary solution i fixed this by initilizing the variable and then used that variable like this
private String[] user = {"$user"};
@RequestMapping(value = {"/user"})
public somemethod(){
}
can any one tell how to initialize the value variable in the annotation it self.
Please sign in to leave a comment.
Hi
sorry the last message is wrong actually this is the case.
i have a requirement to generate a code like this @RequestMapping(value = {"/user"}) but it is throwing exception as a temporary solution i fixed this by initilizing the variable and then used that variable like this
private String[] user = {"$user"};
@RequestMapping(value = this.user)
public somemethod(){
}
can any one tell how to initialize the value variable in the annotation it self.
Hello Surya,
What exception it throwing?
Regards,
Evgeny
hi Evgeny Kurbatsky,
First of all it is not accepting to initalize a type variable with array of string in annotation.Here i am attaching the screenshot of my editor.
regards,
suryakiran
Attachment(s):
Error.png
hi Evgeny Kurbatsky,
First of all it is not accepting to initalize a type variable with array of string in annotation.Here i am attaching the screenshot of my editor "Error.png".
regards,
suryakiran
Attachment(s):
Error.png
Hello Surya,
There is a problem in MPS. I have created a issue for this MPS-5496.
There is some workaround. You can enter local variable:
String[] str = {<< ... >>};
And copy {<< ... >>} inside annotation.
Regards,
Evgeny