接口WebService
一个简单的接口服务
最近写了一个接口服务,发现有许多东西自己都忘了,记在笔记本上又怕忘了,所以想想还是写在微博上吧。
开发环境
tomcat 8.0.52、maven 3.3.9、JDK1.8
开发工具
Intellij IDEA
技术实现
Spring + SpringMVC + Mybatis
主要配置文件
jdbc.properties
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
jdbc.username=xiongzx123
jdbc.password=xiongzx123
#定义初始连接数
jdbc.initialSize=0
#定义最大连接数
jdbc.maxActive=20
#定义最大空闲
jdbc.maxIdle=20
#定义最小空闲
jdbc.minIdle=1
#定义最长等待时间
jdbc.maxWait=60000
srping-cxf.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:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<!--<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>-->
<bean id="ServiceImpl" class="com.sunland.webservice.impl.WebServiceImpl"/>
<jaxws:endpoint id="financeServiceWsdl" implementor="#ServiceImpl" address="/vioService">
<jaxws:inInterceptors>
<bean class="com.sunland.webservice.WebServiceInterceptor"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
</beans>
spring-mybatis.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.sunland"/>
<context:property-place