[5.0] Add EndpointTrait

Make `MethodEndpoint` and `ResourceEndpoint ` use `EndpointTrait`.
And here.