0028ssm环境搭建(springmvc+spring+mybatis)
spring整合springmvc和mybatis主要分为如下几个步骤:
1、spring环境搭建
2、springmvc环境搭建
3、spring整合springmvc
4、spring整合mybatis
具体如下:
先把最基本的会用到的内容创建出来
a、创建maven项目的过程(可参考之前创建springmvc项目的过程)
b、pom.xml中引入spring、springmvc、mybatis、jdbc、mysql、jstl等一系列相关jar包
c、创建controller类、service接口和实现类、dao接口、domain实体、数据库表(如果只是搭建spring环境,只需service即可,为了后面方便,此处统一建了)
1、spring环境搭建
spring环境搭建好的一个标志就是将service交给容器管理
a、applicationContext.xml中开启注解扫描,并排除扫描controller,因为controller是要交给springmvc管理的
b、service上加注解,交给容器管理,并可以给servcie起名字
c、编写测试类EmpTest中的run1()方法测试spring环境是否搭建好
2、springmvc环境搭建
springmvc环境搭建好的一个标志就是页面发送请求能够正常访问到controller中的方法
a、web.xml中配置前端控制器和中文乱码的过滤器
b、resources下创建springmvc.xml,并改约束xmlns
1、开启注解扫描,只扫描controller
2、配置视图解析器
3、过滤静态资源-->webapp下建立相应目录
4、开启springmvc注解的支持
c、创建index.jsp-->写<a>标签访问controller的方法
d、controller上加@Controller注解交给容器管理,并写对应的查询方法,返回"list"字符串
e、在/WEB-INF/pages下建立list.jsp
f、部署项目并启动,进行简单测试
3、spring整合springmvc
整合成功的一个标志是controller能够调用到service中的方法
a、web.xml中配置监听器ContextLoaderListener和上下文初始话参数context-param,
用监听器监听容器启动的时候加载上下文参数中配置的spring配置文件
b、controller中注入service
c、重新启动项目进行测试
4、spring整合mybatis
spring整合mybatis成功的标志是service能够调用到dao对象,且dao能操作数据库
a、在spring的配置文件中进行配置
1、配置连接池
2、配置SqlSessionFactory工厂(其中还需要配置映射文件路径mapperLocations)
3、配置扫描接口所在的包
b、dao上加上注解@MapperScan(写@Repository是不行的,无法与映射文件做关联,查询时会报错)
c、service中注入dao,并调用dao的方法
目录结构如下:
代码实现如下:
1、index.jsp
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2019/12/9
Time: 12:50
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--访问路径是相对路径,前边没有/--%>
<a href="emp/queryusers">springmvc测试</a>
<form action="emp/addEmp" method="post">
员工姓名:<input type="text" name="lastName"><br>
邮箱:<input type="text" name="email"><br>
性别<input type="text" name="gender"><br>
部门编号:<input type="text" name="dId"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
2、EmpController.java
package com.example.controller; import com.example.domain.Employee;
import com.example.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; @Controller
@RequestMapping("/emp")
public class EmpController {
//service是spring管理的,只有spring整合了springmvc后才能依赖注入
@Autowired
private EmpService empService;
@RequestMapping("/queryusers")
public String queryusers(Model model){
List<Employee> users = empService.queryusers();
System.out.println("执行EmpController中的queryusers");
model.addAttribute("users",users);
System.out.println(users);
return "list";
}
@RequestMapping("addEmp")
public void addEmp(Employee employee, HttpServletRequest request, HttpServletResponse response)throws Exception{
empService.addEmp(employee);
response.sendRedirect(request.getContextPath()+"/emp/queryusers"); }
}
3、EmpDao.java
package com.example.dao; import com.example.domain.Employee;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.stereotype.Repository; import java.util.List; @MapperScan
/*@Repository*/
public interface EmpDao {
public List<Employee> queryusers(); public void addEmp(Employee employee);
}
4、Employee.java
package com.example.domain; public class Employee {
private int id;
private String lastName;
private String email;
private String gender;
private int dId; public int getId() {
return id;
} public void setId(int id) {
this.id = id;
} public String getLastName() {
return lastName;
} public void setLastName(String lastName) {
this.lastName = lastName;
} public String getEmail() {
return email;
} public void setEmail(String email) {
this.email = email;
} public String getGender() {
return gender;
} public void setGender(String gender) {
this.gender = gender;
} public int getdId() {
return dId;
} public void setdId(int dId) {
this.dId = dId;
} @Override
public String toString() {
return "Employee{" +
"id=" + id +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", gender='" + gender + '\'' +
", dId=" + dId +
'}';
}
}
5、EmpMapper.xml
<?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.example.dao.EmpDao">
<!--id应该是接口中的方法,结果类型如没有配置别名则应该使用全名称 -->
<select id="queryusers" resultType="com.example.domain.Employee">
select id,lastName,email,gender from employee
</select> <insert id="addEmp" parameterType="com.example.domain.Employee">
insert into employee values(null,#{lastName},#{email},#{gender},#{dId})
</insert>
</mapper>
6、EmpServiceImpl.java
package com.example.service.impl; import com.example.dao.EmpDao;
import com.example.domain.Employee;
import com.example.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; @Service("empService")
public class EmpServiceImpl implements EmpService {
@Autowired
private EmpDao empDao;
@Override
public List<Employee> queryusers() {
List<Employee> users = empDao.queryusers();
System.out.println("执行EmpServiceImpl中的queryusers方法");
return users;
} @Override
// @Transactional
public void addEmp(Employee employee) throws RuntimeException{
System.out.println("执行EmpServiceImpl中的addEmp方法");
empDao.addEmp(employee);
int a=10/0;
System.out.println(a);
}
}
7、EmpTest.java
package com.example.test; import com.example.service.EmpService;
import com.example.service.impl.EmpServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; public class EmpTest {
/*spring环境搭建测试 */
@Test
public void run1(){
//加载配置文件
ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
//获取对象
EmpService empService = (EmpServiceImpl)ac.getBean("empService");
//调用方法
empService.queryusers(); }
}
8、list.jsp
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2019/12/9
Time: 12:45
To change this template use File | Settings | File Templates.
--%> <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>成功进入list页面</h3>
<c:forEach items="${users}" var="user">
${user.lastName}
</c:forEach>
</body>
</html>
9、pom.xml
<?xml version="1.0" encoding="UTF-8"?> <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> <groupId>com.example</groupId>
<artifactId>springmvc-sping-mybatis</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging> <name>springmvc-sping-mybatis Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<spring.version>5.0.2.RELEASE</spring.version>
</properties> <dependencies>
<!--添加spring、springmvc依赖-->
<!-- aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency> <!-- aspects -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- contexts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- core -->
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>-->
<!-- expression -->
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>-->
<!-- orm -->
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>-->
<!-- jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- tx -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
<!--添加spring、springmvc依赖-->
<!--mybatis-spring适配器 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.0</version>
</dependency>
<!--mysql数据库驱动,版本要与所装数据库版本兼容,否则会报错 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<!-- mybatis ORM框架 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.1</version>
</dependency>
<!--c3p0 连接池 -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<!--配置页面引入的jstl所需的依赖-->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency> </dependencies> <build>
<!--resources这段配置必须加,否则dao接口和映射文件无法绑定,访问时会报错-->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<finalName>springmvc-sping-mybatis</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
10、web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app>
<display-name>Archetype Created Web Application</display-name>
<!--配置监听器,监听到容器启动的时候加载spring的配置文件,默认只加载/WEB-INF/applicationContext.xml-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--设置加载spring配置文件的路径-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!--配置springmvc的前端控制器-->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<!--加载springmvc.xml,使其配置生效-->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
<!--启动时就创建DispatcherServlet对象,所以启动时就会加载springmvc.xml-->
<load-on-startup>1</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!--配置解决中文乱码的过滤器-->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> </web-app>
11、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:mvc="http://www.springframework.org/schema/mvc"
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/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd "> <!--spring环境,开启注解扫描,管理service层,不应该管理controller层,controller层应该由springmvc管理-->
<context:component-scan base-package="com.example">
<!--该包下的哪些注解不扫描-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> <!--spring整合mybats开始-->
<!--配置连接池-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://192.168.225.132:3306/jdbc?useSSL=false" />
<property name="user" value="root" />
<property name="password" value="123" />
</bean>
<!--配置SqlSessionFactory工厂-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 自动扫描mapping.xml文件,**表示迭代查找,且dao接口上写@MapperScan -->
<property name="mapperLocations" value="classpath:com/example/mapper/*.xml " />
</bean>
<!--配置扫描接口所在的包-->
<bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.example.dao"/>
<!--<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>-->
</bean>
<!--spring整合mybats结束--> <!--配置spring声明式事物管理开始-->
<!--1配置事物管理-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--2配置事物通知,即不同方法的事物管理方式-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="query*" read-only="true"/>
<tx:method name="*" isolation="DEFAULT"/>
</tx:attributes>
</tx:advice>
<!--3配置AOP增加,即哪些方法上加事物-->
<aop:config>
<!--任意返回类型,com.example.service.impl包下以ServiceImpl结尾的类,任意参数的任意方法-->
<aop:advisor advice-ref="txAdvice" pointcut="execution(* com.example.service.impl.*.*.*(..))"/>
</aop:config>
<!--配置spring声明式事物管理结束-->
</beans>
12、springmvc.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:mvc="http://www.springframework.org/schema/mvc"
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/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd ">
<!--开启注解扫描,只扫描controller-->
<context:component-scan base-package="com.example">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> <!--视图解析器,根据Controller返回的字符串找对应的文件-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--文件路径-->
<property name="prefix" value="/WEB-INF/pages/" />
<!--文件后缀-->
<property name="suffix" value=".jsp" />
</bean> <!--jsp页面引入的js文件也会被拦截,配置哪些静态资源文件不要被前端控制器拦截-->
<mvc:resources mapping="/js/" location="/js/**" />
<mvc:resources mapping="/css/" location="/css/**" />
<mvc:resources mapping="/images/" location="/images/**" />
<!--开启springmvc框架注解的支持-->
<mvc:annotation-driven/> </beans>
如有理解不到之处,望指正!
0028ssm环境搭建(springmvc+spring+mybatis)的更多相关文章
- 手把手Maven搭建SpringMVC+Spring+MyBatis框架(超级详细版)
手把手Maven搭建SpringMVC+Spring+MyBatis框架(超级详细版) SSM(Spring+SpringMVC+Mybatis),目前较为主流的企业级架构方案.标准的MVC设计模式, ...
- Maven 搭建SpringMvc+Spring+Mybatis详细记录
总觉得,看比人写的总是那么好,每次搭建框架时都会找博客,找教程来跟着一步一步走,虽然很快搭建成功了,但是经常情况是我并不知道我干了什么,也不记得具体步骤,到底为什么要这么做,今天我详细记录了一下自己搭 ...
- 单工程搭建springmvc+spring+mybatis(maven,idea)
单工程搭建springmvc+spring+mybatis(maven,idea) 1.pom.xml <properties> <project.build.sourceEncod ...
- 项目SpringMVC+Spring+Mybatis 整合环境搭建(1)-> Spring+Mybatis搭建
目录结构 第一步:web.xml 先配置contextConfigLocation 对应的application-context.xml文件 打开webapp\WEB-INF\web.xml, 配置s ...
- 02 mybatis环境搭建 【spring + mybatis】
1 导包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o ...
- 详解手把手Maven搭建SpringMVC+Spring+MyBatis框架(超级详细版)
转载(https://www.jb51.net/article/130560.htm) SSM(Spring+SpringMVC+Mybatis),目前较为主流的企业级架构方案.标准的MVC设计模式, ...
- eclipse + maven 搭建springMVC+Spring+mybatis 系统
首先需要下载maven 安装maven插件.自行百度. 1: 创建maven系统 http://huxiaoheihei.iteye.com/blog/1766986 2:添加pom依赖: pom.x ...
- JavaWeb_(SpringMVC框架)测试SpringMVC&Spring&MyBatis三大整合
搭建 SpringMVC&Spring&MyBatis三大整合 传送门 1.准备 测试搭建S pringMVC&Spring&MyBatis三大整合 用例 a)准备 ...
- springMVC,spring,mybatis全注解搭建框架--第一步,让框架跑起来
自己从事java开发工作也有一年多了,自己却没有亲手搭建一个完整的框架.于是今天自己动手搭建一个,过程中遇到一些问题,倒腾了大半天终于搞定了. 现在给大家分享一下过程,自己也记录下来,以后学习参考使用 ...
随机推荐
- 高级UI-自定义控件
自定义控件在Android开发中有着大量的运用,为了做出符合项目的效果很多时候需要自定义控件,这里就使用两个自定义控件,来说明自定义控件的使用流程 仿QQ侧滑 之前使用DrawerLayout和Nav ...
- JAVA克隆对象报错:The method clone() from the type Object is not visible
将一个对象复制一份,称为对象的克隆技术.在Object类汇总存在一个clone()方法:protected Onject clone() throws CloneNotSupportedExcepti ...
- csp联考T1
本题主要难点在于如何处理dist^2的问题 40分算法 n^2暴力就不必多嘴,直接枚举根节点DFS就行了. 70分算法 对于b=0的情况,我们可以考虑用换根法来计算根节点的变化对总权值带来的影响. 换 ...
- c++ std::cout重定向到文件
cout默认是与监视器(屏幕)相连,cout出来的内容会输出到屏幕上,通常是会在命令行窗口之中.但有时,我们希望将cout出来的具体日志.错误信息写到某个文件之中,而屏幕上仅仅显示出当前进行的任务,以 ...
- win10无法安装软件解决
https://www.windowscentral.com/how-fix-network-resource-unavailable-install-error-windows-10
- INNODB 统计信息采集
SHOW GLOBAL VARIABLES LIKE 'INNODB_STATS_PERSISTENT_SAMPLE_PAGES'; ALTER TABLE TABLE_NAME STATS_SAMP ...
- Authorization源码解析
1.首先调用 Subject.isPermitted*/hasRole* 接口,其会委托给SecurityManager.SecurityManager 接着会委托给 Authorizer: Auth ...
- 环境配置--升级Python 3.6爬坑
升级到3.6之后,发现ctrl alt t呼不出命令台,找了半天发现update manager也打不开,而且没有错误报告.....查阅了一番资料看到有人有类似的问题(https://askubunt ...
- WPF 程序如何跨窗口/跨进程设置控件焦点
原文:WPF 程序如何跨窗口/跨进程设置控件焦点 WPF 程序提供了 Focus 方法和 TraversalRequest 来在 WPF 焦点范围内转移焦点.但如果 WPF 窗口中嵌入了其他框架的 U ...
- nlp-roadmap
nlp-roadmap https://github.com/graykode/nlp-roadmap nlp-roadmap is Natural Language Processing ROADM ...