Record another way I use the jersey framework in my project. The java part of the project framework adopts spring+jersey+mybatis, and the database adopts mysql. The idea is actually very simple, use the interface as the resource of jersey. Why is there such a requirement? In fact, it is also very simple. I don't want to write Resource separately. The only purpose is to reduce the amount of code of programmers in a reasonable way. Doing more with less code is something I've been thinking about. Don't talk about theory, let's go directly to the code. web.xml configuration:
spring配置:
interface接口类:
接口实现类:
调用的时候 ajax请求 http://localhost:8080/restful/userInfoService/156 进入的就是UserInfoService接口的getUser方法。
而如果其他的service实现类中需要使用UserInfoService接口的话, 跟传统用法一样,