Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
S
SpringMVC_sys
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Framework
SpringMVC_sys
提交
e0490ec4
提交
e0490ec4
编写于
9月 05, 2019
作者:
IBZGIT01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
26f0a946
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
144 行增加
和
0 行删除
+144
-0
pom.xml
pom.xml
+53
-0
applicationContext.xml
src/main/resources/applicationContext.xml
+7
-0
ibizsys-dispatcher-servlet.xml
src/main/resources/ibizsys-dispatcher-servlet.xml
+21
-0
ApplicationTest.java
src/main/test/ApplicationTest.java
+35
-0
web.xml
web/WEB-INF/web.xml
+28
-0
未找到文件。
pom.xml
0 → 100644
浏览文件 @
e0490ec4
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
springmvc_sys
</artifactId>
<groupId>
cn.ibizhub.demo
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
<packaging>
war
</packaging>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<junit.version>
4.12
</junit.version>
<spring-version>
4.2.4.RELEASE
</spring-version>
<jackson.version>
2.9.9.3
</jackson.version>
<servlet.version>
4.0.1
</servlet.version>
<lombok.version>
1.18.6
</lombok.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
${spring-version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-test
</artifactId>
<version>
${spring-version}
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
${jackson.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
${servlet.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/resources/applicationContext.xml
0 → 100644
浏览文件 @
e0490ec4
<?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>
\ No newline at end of file
src/main/resources/ibizsys-dispatcher-servlet.xml
0 → 100644
浏览文件 @
e0490ec4
<?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"
>
<!-- 扫描web包-->
<context:component-scan
base-package=
"cn.ibizhub.demo.*.rest"
/>
<bean
class=
"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"
/>
<bean
class=
"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"
>
<property
name=
"messageConverters"
>
<list>
<bean
class=
"org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"
/>
</list>
</property>
</bean>
</beans>
\ No newline at end of file
src/main/test/ApplicationTest.java
0 → 100644
浏览文件 @
e0490ec4
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MvcResult
;
import
org.springframework.test.web.servlet.request.MockMvcRequestBuilders
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.web.context.WebApplicationContext
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
={
"classpath:ibizsys-dispatcher-servlet.xml"
,
"classpath:applicationContext.xml"
})
@WebAppConfiguration
public
class
ApplicationTest
{
private
MockMvc
mockMvc
;
@Autowired
protected
WebApplicationContext
wac
;
@Before
public
void
beforeTest
()
{
mockMvc
=
MockMvcBuilders
.
webAppContextSetup
(
wac
).
build
();
}
@Test
public
void
testMain
()
{
try
{
MvcResult
mvcResult
=
mockMvc
.
perform
(
MockMvcRequestBuilders
.
post
(
"/tsweb2/quickstart/qjd.do"
)).
andReturn
();
System
.
out
.
println
(
String
.
format
(
"返回状态码为:[%s],返回内容为[%s]"
,
mvcResult
.
getResponse
().
getStatus
(),
mvcResult
.
getResponse
().
getContentAsString
()));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
web/WEB-INF/web.xml
0 → 100644
浏览文件 @
e0490ec4
<?xml version="1.0" encoding="utf-8" ?>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id=
"WebApp_ID"
version=
"3.0"
>
<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
classpath:applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>
demo
</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
classpath:/ibizsys-dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>
2
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
demo
</servlet-name>
<url-pattern>
/
</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录