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

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -