zoukankan      html  css  js  c++  java
  • 基于CXF开发crm服务

    基于CXF开发crm服务

    1.1 数据库环境搭建

    1.2 web项目环境搭建

    第一步:创建动态web项目

    第二步:导入CXF相关jar

    第三步:配置web.xml

    <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>classpath:cxf.xml</param-value>
      </context-param>
      <!-- 配置监听器加载CXF的cxf.xml -->
      <listener>
          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      <!-- 配置CXF框架提供的Servlet -->
      <servlet>
          <servlet-name>cxf</servlet-name>
          <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
      </servlet>
      <servlet-mapping>
          <servlet-name>cxf</servlet-name>
          <url-pattern>/service/*</url-pattern>
      </servlet-mapping>

    第四步:在类路径下提供cxf.xml

    第五步:针对t_customer表创建一个Customer客户实体类

    第六步:开发一个接口和实现类

    第七步:配置cxf.xml

    <!-- 配置数据源 -->
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
            <property name="url" value="jdbc:mysql:///crm_javaweb"/>
            <property name="username" value="root"/>
            <property name="password" value=""/>
        </bean>
        
        <!-- 事物管理器 -->
        <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>
        <!-- 支持事务注解 -->
        <tx:annotation-driven transaction-manager="txManager"/>
        
        <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
            <property name="dataSource" ref="dataSource" />
        </bean>
        <bean id="customerService" class="com.javaweb.crm.service.CustomerServiceImpl">
            <property name="jdbcTemplate" ref="jdbcTemplate" />
        </bean>
        
        <!-- 注册服务 -->
        <jaxws:server id="mtService" address="/service">
            <jaxws:serviceBean>
                <ref bean="customerService"/>
            </jaxws:serviceBean>
        </jaxws:server>
  • 相关阅读:
    进程
    Visual Studio Code 使用教程
    C# 多线程中的lock与token模式
    JavaScript中的多态
    简说GC垃圾回收
    C# 简单的SQLHelper
    JavaScript中addEventListener/attachEvent 与内联事件
    JavaScript中事件冒泡与事件捕获
    ASP.Net ScriptManager 与 UpdatePanel
    Nhibernate 使用sql语句查询
  • 原文地址:https://www.cnblogs.com/FanJava/p/9283588.html
Copyright © 2011-2022 走看看