使用Intellij Idea 和SpringMVC开发具有RESTful架构风格的API接口
2016-05-16 16:34
573 查看
下载地址:http://www.jetbrains.com/idea/#chooseYourEdition
另外还需要下载tomcat
http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.zip
安装教程:
以上是激活intellij idea的方法
配置tomcat
Spring mvc配置
Web.xml
dispatcher-servlet.xml
另外还需要下载tomcat
http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.zip
安装教程:
以上是激活intellij idea的方法
配置tomcat
Spring mvc配置
Web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/dispatcher-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.crobot.controller"/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> </bean> </beans> applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> </beans>
相关文章推荐
- (java)Bulb Switcher
- Git下载Spring项目源码并编译为Eclipse
- Java 迭代器
- jboss 报错 java.io.IOException: No space left on device
- maven构建springmvc+mybaits简单例子
- JAVA——高级for循环
- Java的输入对话框
- Java常用实体类--Runtime类
- java抓取全部网页内容
- spring-boot 拦截器
- [疯狂Java]NIO.2:WatchService、WatchKey(监控文件变化)
- [Java] 一、对象的创建 & 销毁
- Java中有两种实现多线程的方式的区别
- 逆波兰表达式 java
- Java TreeMap工作原理及实现(二)
- java中重量级和轻量级的区别
- Java通过SMS短信平台实现发短信功能
- [转]hibernateTools工具安装及使用总结(eclipse 3.6)
- javase 基础 :变量
- JAVA Socket 编程