java - How to version my API with Spring MVC? -
for now, urls of api example:
/api/users
with spring mvc:
@requestmapping("/api/users")
i version api:
/api-v1.0/users
the best able use spel in @requestmapping
annotation, it unfortunately not possible:
@requestmapping("/api-#{appprops['version']}/users")
what other options then?
@requestmapping resolves property place holder values. define propertysourcesplaceholderconfigurer below.
<context:property-placeholder location="classpath*:*.properties"/>
then use syntax below.
@requestmapping("/api-${version}/users")
Comments
Post a Comment