maven整合 spring4+struts2+mybatis

文件列表:


D:\code\51cto\ssmtwo>tree /f
卷 软件 的文件夹 PATH 列表
卷序列号为 0E4E-0F5F
D:.
│  .classpath
│  .project
│  .springBeans
│  pom.xml
│
├─.settings
│      org.eclipse.core.resources.prefs
│      org.eclipse.jdt.core.prefs
│      org.eclipse.wst.common.component
│      org.eclipse.wst.common.project.facet.core.xml
│      org.eclipse.wst.validation.prefs
│
└─src
    ├─main
    │  ├─java
    │  │  └─com
    │  │      └─laolang
    │  │          └─ssm
    │  │              ├─action
    │  │              │      HelloAction.java
    │  │              │
    │  │              ├─dao
    │  │              │      PersonMapper.java
    │  │              │
    │  │              ├─mapping
    │  │              │      PersonMapper.xml
    │  │              │
    │  │              ├─model
    │  │              │      Person.java
    │  │              │
    │  │              └─service
    │  │                  │  PersonService.java
    │  │                  │
    │  │                  └─impl
    │  │                          PersonImpl.java
    │  │
    │  ├─resources
    │  │  │  applicationContext.xml
    │  │  │  db.properties
    │  │  │  struts.xml
    │  │  │
    │  │  └─com
    │  │      └─laolang
    │  │          └─ssm
    │  │              └─mapping
    │  │                      PersonMapper.xml
    │  │
    │  └─webapp
    │      │  index.jsp
    │      │  success.jsp
    │      │
    │      └─WEB-INF
    │              web.xml
    │
    └─test
        ├─java
        └─resources

D:\code\51cto\ssmtwo>




配置文件:


pom.xml:


<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.laolang.ssm</groupId>
	<artifactId>ssmtwo</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>ssmtwo Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-core</artifactId>
			<version>2.3.16.3</version>
		</dependency>

		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-spring-plugin</artifactId>
			<version>2.3.16</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.0.2.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.0.2.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.0.2.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.0.2.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.0.2.RELEASE</version>
		</dependency>


		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.6</version>
		</dependency>

		<dependency>
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.2</version>
		</dependency>


		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.2.2</version>
		</dependency>

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.2.5</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>    <!--这里也可以使用tomcat7-maven-plugin -->
				<version>2.2</version>   <!--最新版本 -->
				<configuration>
					<url>http://localhost:8080/manager/text</url>    <!--配置远程tomcat的路劲 -->
					<username>admin</username>
					<password>admin</password>
					<uriEncoding>UTF-8</uriEncoding>   <!--tomcat的url编码 达到和修改server.xml文件一样的功能 -->
				</configuration>
			</plugin>
		</plugins>
	</build>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
</project>

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" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:c="http://www.springframework.org/schema/c" xmlns:cache="http://www.springframework.org/schema/cache"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:lang="http://www.springframework.org/schema/lang"
	xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:task="http://www.springframework.org/schema/task"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
		http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
		http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.0.xsd
		http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

	<!-- 数据源连接信息配置文件 -->
	<context:property-placeholder location="classpath*:db.properties" />

	<!-- 配置 C3P0 数据源 -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="user" value="${jdbc.user}"></property>
		<property name="password" value="${jdbc.password}"></property>
		<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
		<property name="driverClass" value="${jdbc.driverClass}"></property>

		<property name="initialPoolSize" value="${jdbc.initPoolSize}"></property>
		<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
	</bean>

	<!-- mybatis sqlSessionFactory -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"></property>
		<property name="mapperLocations" value="classpath:com/laolang/ssm/mapping/*.xml"></property>
	</bean>

	<!-- mybatis-spring 自动扫描dao -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.laolang.ssm.dao" />
	</bean>

	<!-- service -->
	<bean id="personService" class="com.laolang.ssm.service.impl.PersonImpl">
		<property name="personMapper" ref="personMapper"></property>
	</bean>

	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	
	<!-- domain -->
	

	<!-- action -->
	<!-- 注意: 在 IOC 容器中配置 Struts2 的 Action 时, 需要配置 scope 属性, 其值必须为 prototype -->
	<bean id="helloAction" class="com.laolang.ssm.action.HelloAction"
		scope="prototype">
		<property name="msg" value="hello struts2 and spring4"></property>
		<property name="personService" ref="personService"></property>
	</bean>

</beans>

 db.properties



jdbc.user=root
jdbc.password=root
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true

jdbc.initPoolSize=5
jdbc.maxPoolSize=10



struts.xml



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />

    <package name="default" namespace="/" extends="struts-default">
		
		<!--  
			Spring 整合 Struts2 时, 在 Struts2 中配置的 Spring 的 Action 的 class 需要指向 IOC 容器中该 bean 的 id
		-->
		<action name="hello" class="helloAction">
			<result>/success.jsp</result>
		</action>
		
    </package>

</struts>



com/laolang/ssm/mapping/PersonMapper.xml [mybatis-generator自动生成]



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.laolang.ssm.dao.PersonMapper">
	<resultMap id="BaseResultMap" type="com.laolang.ssm.model.Person">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="name" property="name" jdbcType="VARCHAR" />
		<result column="age" property="age" jdbcType="INTEGER" />
		<result column="sex" property="sex" jdbcType="VARCHAR" />
		<result column="password" property="password" jdbcType="VARCHAR" />
	</resultMap>
	<sql id="Base_Column_List">
		id, name, age, sex, password
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from person
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		delete from person
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.laolang.ssm.model.Person">
		insert into person (id, name, age,
		sex, password)
		values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
		#{age,jdbcType=INTEGER},
		#{sex,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR})
	</insert>
	<insert id="insertSelective" parameterType="com.laolang.ssm.model.Person">
		insert into person
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="name != null">
				name,
			</if>
			<if test="age != null">
				age,
			</if>
			<if test="sex != null">
				sex,
			</if>
			<if test="password != null">
				password,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="name != null">
				#{name,jdbcType=VARCHAR},
			</if>
			<if test="age != null">
				#{age,jdbcType=INTEGER},
			</if>
			<if test="sex != null">
				#{sex,jdbcType=VARCHAR},
			</if>
			<if test="password != null">
				#{password,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.laolang.ssm.model.Person">
		update person
		<set>
			<if test="name != null">
				name = #{name,jdbcType=VARCHAR},
			</if>
			<if test="age != null">
				age = #{age,jdbcType=INTEGER},
			</if>
			<if test="sex != null">
				sex = #{sex,jdbcType=VARCHAR},
			</if>
			<if test="password != null">
				password = #{password,jdbcType=VARCHAR},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.laolang.ssm.model.Person">
		update person
		set name = #{name,jdbcType=VARCHAR},
		age = #{age,jdbcType=INTEGER},
		sex = #{sex,jdbcType=VARCHAR},
		password = #{password,jdbcType=VARCHAR}
		where id = #{id,jdbcType=INTEGER}
	</update>
</mapper>



web.xml



<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
	<!-- 配置 Spring 配置文件的名称和位置 -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>

	<!-- 启动 IOC 容器的 ServletContextListener -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- 配置 Struts2 的 Filter -->
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
</web-app>


ssm.sql


/*
Navicat MySQL Data Transfer

Source Server         : laolang
Source Server Version : 50617
Source Host           : localhost:3306
Source Database       : ssm

Target Server Type    : MYSQL
Target Server Version : 50617
File Encoding         : 65001

Date: 2016-05-06 06:44:08
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for person
-- ----------------------------
DROP TABLE IF EXISTS `person`;
CREATE TABLE `person` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `sex` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of person
-- ----------------------------
INSERT INTO `person` VALUES ('1', '小明1', '1', '男1', '1');
INSERT INTO `person` VALUES ('2', '小明2', '2', '男2', '2');
INSERT INTO `person` VALUES ('3', '小明3', '3', '男3', '3');
INSERT INTO `person` VALUES ('4', '小明4', '4', '男4', '4');
INSERT INTO `person` VALUES ('5', '小明5', '5', '男5', '5');
INSERT INTO `person` VALUES ('6', '小明6', '6', '男6', '6');
INSERT INTO `person` VALUES ('7', '小明7', '7', '男7', '7');
INSERT INTO `person` VALUES ('8', '小明8', '8', '男8', '8');
INSERT INTO `person` VALUES ('9', '小明9', '9', '男9', '9');






代码:

com.laolang.ssm.action.HelloAction


package com.laolang.ssm.action;

import com.laolang.ssm.model.Person;
import com.laolang.ssm.service.PersonService;

public class HelloAction {

	private String msg;

	private Person person;

	private PersonService personService;

	public String execute() {
		person = personService.findPersonById(1);
		msg = msg + "\n" + person.toString();
		return "success";
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public PersonService getPersonService() {
		return personService;
	}

	public void setPersonService(PersonService personService) {
		this.personService = personService;
	}

}



com.laolang.ssm.dao.PersonMapper



package com.laolang.ssm.dao;

import com.laolang.ssm.model.Person;

public interface PersonMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Person record);

    int insertSelective(Person record);

    Person selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Person record);

    int updateByPrimaryKey(Person record);
}



com.laolang.ssm.model.Person



package com.laolang.ssm.model;

public class Person {

	public Person() {
		super();
	}

	public Person(String name, Integer age, String sex, String password) {
		super();
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.password = password;
	}

	public Person(Integer id, String name, Integer age, String sex, String password) {
		super();
		this.id = id;
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.password = password;
	}

	@Override
	public String toString() {
		return "Person [id=" + id + ", name=" + name + ", age=" + age + ", sex=" + sex + ", password=" + password + "]";
	}

	private Integer id;

	private String name;

	private Integer age;

	private String sex;

	private String password;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name == null ? null : name.trim();
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex == null ? null : sex.trim();
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password == null ? null : password.trim();
	}
}



com.laolang.ssm.service.PersonService



package com.laolang.ssm.service;

import com.laolang.ssm.model.Person;

public interface PersonService {
	
	public Person findPersonById( Integer id);

}



com.laolang.ssm.service.impl.PersonImpl



package com.laolang.ssm.service.impl;

import com.laolang.ssm.dao.PersonMapper;
import com.laolang.ssm.model.Person;
import com.laolang.ssm.service.PersonService;

public class PersonImpl implements PersonService {

	private PersonMapper personMapper;

	public PersonMapper getPersonMapper() {
		return personMapper;
	}

	public void setPersonMapper(PersonMapper personMapper) {
		this.personMapper = personMapper;
	}

	@Override
	public Person findPersonById(Integer id) {
		return personMapper.selectByPrimaryKey(id);
	}

}


项目运行

在CMD中进入当前项目路径,执行:mvn tomcat7:run

在我的电脑上显示如下:


D:\code\51cto\ssmtwo>mvn tomcat7:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ssmtwo Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ ssmtwo >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ssmtwo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ssmtwo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to D:\code\51cto\ssmtwo\target\classes
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ ssmtwo <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ ssmtwo ---
[INFO] Running war on http://localhost:8080/ssmtwo
[INFO] Creating Tomcat server configuration at D:\code\51cto\ssmtwo\target\tomcat
[INFO] create webapp with contextPath: /ssmtwo
五月 06, 2016 6:40:27 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
五月 06, 2016 6:40:27 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Tomcat
五月 06, 2016 6:40:27 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.47
五月 06, 2016 6:40:33 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
五月 06, 2016 6:40:33 上午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started
五月 06, 2016 6:40:33 上午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing Root WebApplicationContext: startup date [Fri May 06 06:40:33 GMT+08:00 2016]; root of context hierarchy
五月 06, 2016 6:40:33 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
五月 06, 2016 6:40:34 上午 org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
信息: Loading properties file from URL [file:/D:/code/51cto/ssmtwo/target/classes/db.properties]
五月 06, 2016 6:40:34 上午 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init>
信息: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
五月 06, 2016 6:40:34 上午 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
五月 06, 2016 6:40:34 上午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.2 [built 09-February-2013 02:13:17 +0000; debug? true; trace: 10]
五月 06, 2016 6:40:35 上午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization completed in 2016 ms
五月 06, 2016 6:40:35 上午 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info
信息: Parsing configuration file [struts-default.xml]
五月 06, 2016 6:40:35 上午 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info
信息: Parsing configuration file [struts-plugin.xml]
五月 06, 2016 6:40:36 上午 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info
信息: Parsing configuration file [struts.xml]
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (spring) for (com.opensymphony.xwork2.ObjectFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ActionFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ResultFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ConverterFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.factory.InterceptorFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ValidatorFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.FileManagerFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.CollectionConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.ArrayConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.DateConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.NumberConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.StringConverter)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionFileProcessor)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterCreator)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterHolder)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.LocaleProvider)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
五月 06, 2016 6:40:36 上午 org.apache.struts2.config.AbstractBeanSelectionProvider info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.TextParser)
五月 06, 2016 6:40:36 上午 org.apache.struts2.spring.StrutsSpringObjectFactory info
信息: Initializing Struts-Spring integration...
五月 06, 2016 6:40:36 上午 com.opensymphony.xwork2.spring.SpringObjectFactory info
信息: Setting autowire strategy to name
五月 06, 2016 6:40:36 上午 org.apache.struts2.spring.StrutsSpringObjectFactory info
信息: ... initialized Struts-Spring integration successfully
五月 06, 2016 6:40:37 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]



打开地址:http://localhost:8080/ssmtwo/  显示如下:


maven整合 spring4+struts2+mybatis_第1张图片


单击hello链接,则显示如下:

maven整合 spring4+struts2+mybatis_第2张图片

可以看到,struts2 的action可以正常访问,且可以mybatis可以正常使用了


项目下载:

http://www.oschina.net/code/snippet_1442002_55946



你可能感兴趣的:(maven整合 spring4+struts2+mybatis)