0

when creating a Webservice, can I somehow use static String vars?

@WebService(
        portName = Util.PORT,
        serviceName = Util.SERVICE,
        targetNamespace = ...,
        endpointInterface = ...)
public class MyWsClass implements WsInterface

result:

The value for annotation attribute WebService.portName must be a constant expression

So can't I use static vars?

membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • How have you defined Util.PORT? – JamesB Aug 09 '12 at 21:10
  • 1
    possible duplicate of [How to supply value to an annotation from a Constant java](http://stackoverflow.com/questions/2065937/how-to-supply-value-to-an-annotation-from-a-constant-java) – Keppil Aug 09 '12 at 21:10

1 Answers1

0

relevant SO question: How to supply value to an annotation from a Constant java

It is possible to set the annotation parameter values from constants if they are Strings or numbrs and declared as static final.

Community
  • 1
  • 1