如下面这种
//http://localhost:8080/api/v1/user/info/email/test@163.com
@RequestMapping(value = "/info/email/{email}",method = RequestMethod.GET)
public User getInfoByEmail(@PathVariable String email){
User user = userRepository.findByEmail(email);
return user;
}
//继承adapter 设置属性即可。
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* Created by Administrator on 2017/7/10 0010.
*/
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
}