Eclipse的springMVC+mybatis

Eclipse使用(八)—— 使用Eclipse创建Spring+SpringMVC+Mybatis(SSM)整合项目 注:这篇主要是讲SSM整合配置以及连接数据库并实现简单的登陆注册功能,如果不知道怎么在Eclipse上创建JavaWeb项目的请参考: Eclipse使用(七)—— 使用Eclipse创建JavaWeb项目并使用JDBC连接数据库实现简单的登陆注册功能 一、项目要使用的jar示例 缺少jar包的可以到Maven中心仓库去下载:Maven Repository 二、编写xml配置文 阅读详情

前置

开发环境

jdk 1.7
maven
开发工具 eclipse
Mysql数据库

1首先创建一个 maven project
创建类型为war 包类型

项目结构如下图

在这里插入图片描述

配置文件

pom.xml中加入

<properties>
  	<!-- spring版本号  -->
		<spring.version>3.2.8.RELEASE</spring.version>
		<!-- log4j日志文件管理包版本  -->
		<slf4j.version>1.6.6</slf4j.version>
		<log4j.version>1.2.12</log4j.version>
		<!-- junit版本号  -->
		<junit.version>4.10</junit.version>
		<!-- mybatis版本号  -->
		<mybatis.version>3.2.1</mybatis.version>
	</properties>
	
	<dependencies>
		<!-- 添加Spring依赖  -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!--单元测试依赖  -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>

		<!-- log4j  -->

		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<!--spring单元测试依赖  -->

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
			<scope>test</scope>
		</dependency>

		<!--mybatis  -->

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>${mybatis.version}</version>
		</dependency>

		<!-- mybatis/spring包  -->

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.2.0</version>
		</dependency>

		<!-- mysql驱动包  -->

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

		<!-- dbcp数据库连接池  -->
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.2.2</version>
		</dependency>
		<!-- javaee-api包 注意和项目使用的JDK版本对应  -->
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-api</artifactId>
			<version>6.0</version>
			<scope>provided</scope>
		</dependency>
		<!-- javaee-web-api包 注意和项目使用的JDK版本对应  -->
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-web-api</artifactId>
			<version>6.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.7.4</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.7.4</version>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.7.4</version>
		</dependency>

	</dependencies>
	

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>
	<!-- Spring配置文件  -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<!-- 启动Web容器时,自动装配ApplicationContext.xml的配置信息  -->
		<param-value>classpath:application.xml</param-value>
	</context-param>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- 加载springmvc配置xml  -->
	<servlet>
		<servlet-name>springMVC</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<!-- 指定上下文的位置  -->
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:springmvc.xml</param-value>
		</init-param>

		<!-- 启动容器时初始化该Servlet  -->
		<load-on-startup>1</load-on-startup>
	</servlet>
	<!-- springMVC 为拦截所有请求  -->
	<servlet-mapping>
		<servlet-name>springMVC</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

<!-- spring处理中文乱码的一个过滤器配置  -->
<filter>
	<filter-name>SpringEncodingFilter</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>
	<init-param>
		<param-name>forceEncoding</param-name>
		<param-value>true</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>SpringEncodingFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Log4j 日志文件存放位置设置  -->
<context-param>
	<param-name>log4jConfigLocation</param-name>
	<param-value>classpath:log4j.properties</param-value>
</context-param>

<!-- 扫描log4j的配置文件周期  -->
<context-param>
	<param-name>log4jRefreshInterval</param-name>
	<param-value>60000</param-value>
</context-param>

<listener>
	<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
</web-app>

springmvc.xml配置如下

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="
	http://www.springframework.org/schema/tx 
	http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-3.2.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">


	<!-- 配置静态资源访问 -->
	<mvc:default-servlet-handler />
	<mvc:annotation-driven />

	<!-- 扫描注解包 -->
	<context:component-scan base-package="com.www.controller" />

	<!-- 配置视图解析器 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>

	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<bean
					class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
					<property name="supportedMediaTypes">
						<list>
							<value>application/json;charset=UTF-8</value>
						</list>
					</property>
				</bean>
			</list>
		</property>
	</bean>

</beans>

application.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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd">

	<!-- 加载外部配置文件 -->
	<context:property-placeholder location="classpath:jdbc.properties" />

	<!-- 注解扫描包文件,此处有多种写法,主要的一点就是controller层作为控制器交由springmvc的配置文件进行扫描 -->
	<!-- <context:component-scan base-package="com.sino" /> -->
	<!-- <context:component-scan base-package="com.sino.*"> <context:exclude-filter 
		type="annotation" expression="org.springframework.stereotype.Controller"/> 
		</context:component-scan> -->
	<context:component-scan base-package="com.www" />

	<!-- 配置数据源 ,可选择dbcp,c3p0,druid等 -->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="url" value="${jdbc_url}" />
<property name="driverClassName" value="${jdbc_driverClassName}" />
<property name="username" value="${jdbc_username}" />
<property name="password" value="${jdbc_password}" />
	</bean>

	<!-- 配置整合mybatis,注意,此处直接将实体类文件到数据库数据表做了映射匹配,便不再额外添加sqlConfig.xml的配置文件,简化了配置的写法 -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"></property>
		<property name="typeAliasesPackage" value="com.www.entity" />
		<!-- 自动扫描mapping.xml文件 -->
		<property name="mapperLocations" value="classpath:mybatis/*.xml"></property>
	</bean>

	<!-- mybatis扫描接口包文件,扫描接口所在的包文件 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.www.dao" />
		<property name="SqlSessionFactoryBeanName" value="sqlSessionFactory" />
	</bean>

	<!-- 事务配置 -->
	<bean id="txManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<!-- 配置拦截service -->
	<!-- <aop:config> <aop:pointcut expression="execution(* com.ssm.service..*(..))" 
		id="txPoint"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint"/> 
		</aop:config> -->

	<!-- 配置事物增强,事物如何切入 -->
	<tx:advice id="txAdvice" transaction-manager="txManager">
		<tx:attributes>
			<!-- 所有方法都是事物方法 -->
<!-- 			<tx:method name="*" /> -->
			<!-- 以get开始的所有方法 -->
			<tx:method name="get*" read-only="true" />
			<tx:method name="query*" read-only="true" />
			<tx:method name="find*" read-only="true" />
			<tx:method name="select*" read-only="true" />
		</tx:attributes>
	</tx:advice>

</beans>

jdbc.proerties配置

jdbc_driverClassName=com.mysql.jdbc.Driver
jdbc_url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
jdbc_username=root
jdbc_password=******

log4j.properties配置如下

log4j.rootLogger=DEBUG,Console,File

#把日志信息输出到控制台 ###
log4j.appender.Console=org.apache.log4j.ConsoleAppender 
log4j.appender.Console.Target=System.out 
log4j.appender.Console.layout = org.apache.log4j.PatternLayout 
log4j.appender.Console.layout.ConversionPattern=%d{yyyy-MM-dd-HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n

#把日志信息输出到文件:/opt/uploads/maven_logs/maven_web.log ###
log4j.appender.File = org.apache.log4j.DailyRollingFileAppender 
log4j.appender.File.File = /opt/uploads/maven_logs/maven_web.log 
log4j.appender.File.Threshold = DEBUG 
log4j.appender.File.layout = org.apache.log4j.PatternLayout 
log4j.appender.File.layout.ConversionPattern =%d{yyyy-MM-dd-HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n

#显示SQL语句部分
log4j.logger.com.mybatis=DEBUG 
log4j.logger.com.mybatis.common.jdbc.SimpleDataSource=DEBUG 
log4j.logger.com.mybatis.common.jdbc.ScriptRunner=DEBUG 
log4j.logger.com.mybatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG 
log4j.logger.java.sql.Connection=DEBUG 
log4j.logger.java.sql.Statement=DEBUG 
log4j.logger.java.sql.PreparedStatement=DEBUG

编码模块

indexController.java

package com.www.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.www.entity.User;
import com.www.service.UserService;

@Controller
public class indexController {

	@RequestMapping("/index")
	public String toIndex(){
	    return "index";
	}

	@ResponseBody
	@RequestMapping("/getData")
	public String getData(){
	    String result = "success";
	    return result;
	}
	
	@Resource
	UserService userService;
	
	@ResponseBody
	@RequestMapping("/testDbData")
	public List<User> testDbData(){
	    return userService.getDbData();
	}
}

User.java

package com.www.entity;

public class User {
	private Integer id;  

    private String name;  

    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;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}    
    
}

UserDao.java

package com.www.dao;
import java.util.List;
import org.mybatis.spring.annotation.MapperScan;
import com.www.entity.User;

@MapperScan
public interface UserDao {

	public User selectUserById(Integer userId); 

	public List<User> selectList(); 
}

UserService.java

package com.www.service;

import java.util.List;
import com.www.entity.User;
public interface UserService {
	
	public User selectUserById(Integer userId);

	public List<User> getDbData(); 
}

UserServiceImpl.java

package com.www.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.www.dao.UserDao;
import com.www.entity.User;
import com.www.service.UserService;

@Service
public class UserServiceImpl  implements UserService{
	@Resource
	private UserDao userDao;

	@Override
	public User selectUserById(Integer userId) {
		return userDao.selectUserById(userId);
	}

	@Override
	public List<User> getDbData() {
		return userDao.selectList();
	}
	}

userDao.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.www.dao.UserDao">
	<!--设置model类和数据库中表的字段一一对应 -->
	<resultMap id="BaseResultMap" type="com.www.entity.User">
		<id column="ID" property="id" jdbcType="INTEGER" />
		<result column="NAME" property="name" jdbcType="CHAR" />
		<result column="PASSWORD" property="password" jdbcType="CHAR" />
	</resultMap>
	<!-- 查询单条记录 -->
	<select id="selectUserById" parameterType="int" resultMap="BaseResultMap">
		SELECT * FROM user WHERE ID = #{userId}
	</select>

	<select id="selectList" resultMap="BaseResultMap">
		SELECT * FROM user
	</select>
</mapper>
eclipse创建springMVC+mybatis项目文档 教你用eclipse一步步创建基于maven下,springMVC+mybatis项目搭建(文档中含图解) 立即下载

相关推荐

SSM框架--(Spring+SpringMVC+Mybatis整合)

Eclipse,Spring,SpringMVC,Mybatis。MySQL。搭建简单易学。

在eclipse创建spring+springMVC+Mybatis的项目

现在使用maven构建的项目会让我们省去jar包的导入和每个工程都导入数量较多jar包的苦恼,特别是在团队开发中,我们应该保证我们使用的jar包的版本一致,使用maven之后,我们仅需要保证pom.xml文件一致。他会自己按节点中配置的信息找到相应的jar包。 下面是自己学习之后构建Spring+SpringMVC+Mybatis的工程构建过程: 1.首先,我们应该确保eclipse中有mav

小白杨 1万+

eclipse下的spring+springmvc+mybatis整合

eclipse下的spring+springmvc+mybatis整合

使用Eclipse如何简单快速搭建SSM(springMVC+Spring+Mybatis)框架

目录前言一、SSM框架整合1.创建项目2.项目调整与配置3.注入依赖4.配置web.xml文件5.配置springmvc-servlet.xml和spring-mybatis.xml6.创建实体类(以Car实体类为例),ICarMapper接口和car.mapper.xml二、编写controller和service层1.编写service层2.编写controller层3.结果演示 前言 SSM框架中有两个核心容器springMVC容器与spring IOC容器。 springMVC容器:负责管理spr

weixin_45024646的博客 2148

手把手教你自制Type-C OTG转换器(附电路图及避坑指南)

本文详细指导如何自制Type-C OTG转换器,包括核心电路设计、元器件选型及焊接技巧,特别强调硬件检测电路的关键作用。通过实测数据和避坑指南,帮助开发者解决兼容性问题,实现高效数据传输。

weixin_27038245的博客 719

Comfy UI实战:如何用Checkpoint和Lora打造超写实人像(附完整工作流)

本文详细介绍了如何利用Comfy UI结合Checkpoint基础模型和Lora微调模型,打造超写实人像生成系统。从核心模型选择、工作流架构设计到提示词工程和参数优化,提供了一套完整的实战指南,帮助创作者提升AI绘画的专业水准和效率。

weixin_29032489的博客 463

基于Eclipse根据Maven整合Spring + SpringMVC + MyBatis(SSM)框架(附带源码)

文章目录一、整合环境准备1、环境注明2、创建数据库和表结构语句3、配置Maven环境如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 一、整合环境准备 1、环境注明 Eclipse、Maven 3.5.0、MySQL 8.0.15、JDK 1.8、Tomcat 8、Spri

u013526643的专栏 1017

Flow Matching03-01:微分方程【微分方程(描述变化规律的方程):包含未知函数和它的导数的方程】【公式解(精确)、数值解(逼近)】

好的,我将从数学角度详细解释Flow Matching,从高中生能理解的基础知识开始,逐步深入到高级概念。

u013250861的博客 221

Eclipse 搭建 Maven Spring Mvc+MyBatis Web 项目 清晰教程

要求 Eclipse Maven 环境配置完善 打开eclipce 点击左上角 file-new file-other-Maven-Maven Project 选择Maven-Maven-Project 创建maven项目 最后选择Next 这里我选择是第二个选项“也就是选择你所保存项目的路径 点击Browse” 选择路径过后 点击maven-archetype-webapp 有的朋...

qq_41193701的博客 784

【Unity-UGUI控件全面解析】| Canvas 画布组件详解

画布 (Canvas) 是应该容纳所有 UI 元素的区域。画布是一种带有画布组件的游戏对象,所有 UI 元素都必须是此类画布的子项。 创建新的 UI 元素(如使用菜单 GameObject > UI > Image 创建图像)时,如果场景中还没有画布,则会自动创建画布。UI 元素将创建为此画布的子项。 画布区域在 Scene 视图中显示为矩形。这样可以轻松定位 UI 元素,而无需始终显示 Game 视图。 画布 使用 EventSystem 对象来协助消息系统。

努力前行,总会成为自己心中的那道光 2万+

ABAP Bits and Bytes 完全参考,理解内存、字节、位运算与类型解释

ABAP开发中业务代码与底层字节处理的差异:业务层关注采购订单、会计凭证等语义信息,而接口开发需处理十六进制、位运算等底层操作。文章通过整数变量示例说明同一段字节在不同类型解释下会呈现不同值,并介绍x类型、位运算及类型转换的实际应用。这些知识在文件接口、加密传输等场景中尤为重要,开发者需注意字节序、编码等问题。建议将底层协议处理与业务逻辑分离,以保持代码清晰和可维护性。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 143

Eclipse搭建SpringMVC+Spring+MyBatis框架

准备工作 资源文件 Eclipse:提取密码:ppvg apache-tomcat-9.0.1:提取密码:yvm2 apache-maven-3.5.0:提取密码:8haj mysql-5.7.20:提取密码:zcwd Navicat+for+MySQL:提取密码: i6h9 安装配置相关的环境 安装数据库:mac安装mysql的两种方法 Mac OS X下Maven的安装与配置 mybat...

weixin_34387284的博客 282

24. SAP 标准产品里使用 OData 服务的一些细节分享

笔者在编写使用事物码 SEGW 开发 SAP OData 服务的系列步骤时,但凡遇到技术上一些疑难问题,喜欢去参照 SAP 标准产品里是如何使用 OData 服务的,不少问题都可以去参考 SAP 标准产品的 OData 服务实现细节来解决。 因此本文记录笔者在编写本教程的过程中,曾经研究过的 SAP OData 服务实现的一些细节,把这些细节分享给大家,希望能起到参考作用。 同时,教程也不断收到一些朋友在评论区留言,对于不少留言的回复,我也是拿 SAP 标准 OData 服务的实现作为论据来回复的。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 2035

eclipse下SpringMVC+Maven+Mybatis+MySQL项目搭建

eclipse下SpringMVC+Maven+Mybatis+MySQL项目搭建 这篇文章主要讲解在eclipse环境下SpringMVC+Maven+Mybatis+MySQL的项目搭建过程。 创建Maven工程。   右击-->New->Other   点击->Manven Porject   点击->勾选快速框架   ...

214

在Keil uv5里面添加STC元器件库,不影响其他元件

先到网上下载stc.CBD(宏晶网站的地址实效了)还有STC新系列单片机的头文件,宏晶的网站就有1、在Keil/C51/INC下新建目录"STC"文件夹, 把所有STC新系列单片机的头文件拷贝到"STC"目录下。2、下载的用于keil下的STC器件数据库更名为STC.CDB并拷贝到Keil/UV4目录下。3、打开Keil文件夹下的TOOLS.ini文件。4、在[UV2]下键入CDB0="UV2\S

技术联盟 1万+

一、DMSP/OLS、NPP/VIIRS等夜间灯光数据能源碳排放空间化理论介绍

利用DMSP/OLS、NPP/VIIRS等夜间灯光数据开展能源碳排放空间化之前,需要区分与利用夜间灯光数据GDP空间化,两者操作流程并无较大区别,只是GDP空间化选择夜间灯光指数种类有比较多包括总灯光指数、平均灯光指数、综合灯光指数等,但是能源碳排放过程中通常只选择总灯光指数,其次能源碳排放空间化可能对于某些省份工业相对没有那么发达的区域,构建模型时候拟合效果比较差,也就是R方低一些或者显著性差。针对上述拟合度低的情况诸多学者前辈从多个方面开展研究进行提升。

端木宛白的博客家园 4925

Eclipse搭建Sprng+SpringMVC+Mybatis框架

Eclipse搭建Sprng+SpringMVC+Mybatis框架整体项目目录第一步第二步第三步 这个给项目整体也是我看视频学的,由于我之前自己找项目十分难找所有分享上来 所需jar包 链接:https://pan.baidu.com/s/1Uu8reoP0AXFTL__gXmsAog 提取码:4ma5 整体项目目录 第一步 打开eclipse,单击右键–》new–》Dynamic Web P...

weixin_40756872的博客 256

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

eclipse中配置SpringMVC+Spring+MyBatis

eclipse中配置SpringMVC+Spring+MyBatis 在很多项目开发中,我都用到了Spring、MyBatis等框架,无奈,自己作为每次都是使用者,自己并未参加相关配置;这就有点悲哀,今天有时间,自己学习一下。考虑到自己技术文笔差,唯恐描述不清楚,特找大神文章以供学习。为了以后自己找方便,权当笔记使用。 不喜勿喷! 更多详尽内容请点击 eclipse中配置SpringMVC+Spr...

展翅雄鹰的博客 491

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

eclipse spring mysql_eclipse下SpringMVC+Maven+Mybatis+MySQL项目搭建

eclipse下SpringMVC+Maven+Mybatis+MySQL项目搭建这篇文章主要讲解在eclipse环境下SpringMVC+Maven+Mybatis+MySQL的项目搭建过程。创建Maven工程。右击-->New->Other点击->Manven Porject点击->勾选快速框架输入项目名,包(Packaging,如果只是普通的项目,选jar就好了,如果...

weixin_39792751的博客 271

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

Maven+Eclipse+SpringMVC+MyBatis整合

Maven+Eclipse+SpringMVC+MyBatis整合 参考:Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(一): [url]http://www.blogjava.net/bolo/archive/2011/05/23/349655.html[/url] Maven最佳实践:版本管理:[url]http://juve...

pyzheng的专栏 153

Eclipse 搭建 Spring+SpringMVC+Mybatis(1)

工作一年多还所有的开发工作都是基于已经搭建好的项目框架上,今天根据别人的经验自己动手搭建一套基于Maven的SSM架构;   SSM:Spring,SpringMVC,Mybatis     环境验证 Java环境验证  Maven环境验证  eclipse maven配置   利用Eclipse搭建SSM 新建maven项目:New &gt; Maven P...

留不住的青春 543

eclipse中mybatis,spring,springmvc的整合

整合第一步第二步第三步 第一步 先搭建mybatis环境 创建一个web项目,在lib文件夹中导入支持mybatis开发的jar包, 相关文件配置 1,mybatis-config.xml文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Co...

YXX_decsdn的博客 459
上一篇: Eclipse的 SpringBoot+MyBatis整合
下一篇: zookeeper+dubbo+nginx服务搭建
上天铺路,入地打洞
博客等级 码龄8年 4粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值