jersey tomcat MySQL_IDEA+Jersey+Tomcat搭建RESTful API

环境:

IDEA Ultimate 2017.2.2 + JDK 1.8 + Jersey 2 + Maven + Tomcat 9.0.0.M22

首先创建项目:

选中Web Application(3.1)框架,勾选Create web.xml,IDE会在创建项目时创建web.xml配置文件。

196d274d65cf

创建项目

创建项目后右键选中项目,添加框架支持,选中Maven,随即生成pom.xml文件。这里会弹出Event对话框,会有提示你Enable Auto-Import,这里我们Enable一下。

196d274d65cf

添加框架

然后开始通过maven添加依赖jar包,引用Jersey,pom.xml配置如下:

com.overc_i3.jerseydemo

JerseyDemo

1.0-SNAPSHOT

1.8

1.8

2.25

org.glassfish.jersey.containers

jersey-container-servlet

${jersey.version}

org.glassfish.jersey.core

jersey-server

${jersey.version}

org.glassfish.jersey.core

jersey-client

${jersey.version}

org.glassfish.jersey.media

jersey-media-json-jackson

${jersey.version}

接下来是配置web.xml,项目里的路径是web/WEB-INF/web.xml,这里我们将 Jersey 当做 Servlet:

jerseyServlet

org.g

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值