在github上搭建ssm项目,记录轻笔记项目的完成进度
来源:互联网 发布:mac 拷贝文件夹 编辑:程序博客网 时间:2024/06/11 00:48
刚开始学习ssm框架不久,也没有做过大型的javaweb项目,目前还在不断学习中,对于ssm框架的基础知识掌握较为一般,正逢研一软件实训阶段,借此机会将在做的项目轻笔记拿上台面,记录我进行该项目的过程,也算是与大家分享新人做项目的历程,鄙人不才,才疏学浅,只能边学边做,有问题只会问度娘,面对满屏的红叉bug经常无所适从,但是项目总是要继续,慢一点没关系,进度还是要有的,顺祝大家新年快乐。
这是刚搭建好的ssm框架并且放在github仓库里了,地址是https://github.com/BrotherCat/lightnote_new
欢迎大家捧场交流合作,当然更多的是希望得到指点
更新
加入user的pojo层,加入userdao的dao层,并且进行junit测试,可读取mysql的数据
UserDaoTest.java:
import com.ruanku.lightnote.dao.UserDao;
import com.ruanku.lightnote.pojo.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by GZR on 2016/11/14.
* configure spring integration junit,load springIoc when junit start
*/
@RunWith(SpringJUnit4ClassRunner.class)
//tell junit the spring configure file
@ContextConfiguration({"classpath:spring-mybatis/spring-mybatis.xml"})
public class UserDaoTest {
//rejection Dao class depend
@Resource
private UserDao userDao;
@Test
public void queryById() throws Exception {
int id=1;
User user=userDao.findByID(id);
System.out.println(user.getUsername());
}
@Test
public void getAll() throws Exception {
List<User> UserList=userDao.findAll();
for(User user:UserList){
System.out.println(user);
}
}
}
打印结果:
////////////////////////////////////////////////////////////////////////////////
1.30
下图是工程目录结构
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.ruanku</groupId>
<artifactId>lightnote</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>lightnote Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<!-- spring版本号 -->
<spring.version>4.0.2.RELEASE</spring.version>
<!-- mybatis版本号 -->
<mybatis.version>3.2.6</mybatis.version>
<!-- log4j日志文件管理包版本 -->
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<!--Expression Language (depends on spring-core) Define this if you use
Spring Expression APIs (org.springframework.expression.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Bean Factory and JavaBeans utilities (depends on spring-core) Define
this if you use Spring Bean APIs (org.springframework.beans.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Aspect Oriented Programming (AOP) Framework (depends on spring-core,
spring-beans) Define this if you use Spring AOP APIs (org.springframework.aop.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<!--Application Context (depends on spring-core, spring-expression, spring-aop,
spring-beans) This is the central artifact for Spring’s Dependency Injection
Container and is generally always defined -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Various Application Context utilities, including EhCache, JavaMail,
Quartz, and Freemarker integration Define this if you need any of these integrations -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<!--Transaction Management Abstraction (depends on spring-core, spring-beans,
spring-aop, spring-context) Define this if you use Spring Transactions or
DAO Exception Hierarchy (org.springframework.transaction.*/org.springframework.dao.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- JDBC Data Access Library (depends on spring-core, spring-beans, spring-context,
spring-tx) Define this if you use Spring’s JdbcTemplate API (org.springframework.jdbc.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA,
and iBatis. (depends on spring-core, spring-beans, spring-context, spring-tx)
Define this if you need ORM (org.springframework.orm.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Object-to-XML Mapping (OXM) abstraction and integration with JAXB,
JiBX, Castor, XStream, and XML Beans. (depends on spring-core, spring-beans,
spring-context) Define this if you need OXM (org.springframework.oxm.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Web application development utilities applicable to both Servlet and
Portlet Environments (depends on spring-core, spring-beans, spring-context)
Define this if you use Spring MVC, or wish to use Struts, JSF, or another
web framework with Spring (org.springframework.web.*) -->
<!-- Spring MVC for Servlet Environments (depends on spring-core, spring-beans,
spring-context, spring-web) Define this if you use Spring MVC with a Servlet
Container such as Apache Tomcat (org.springframework.web.servlet.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Support for testing Spring applications with tools such as JUnit and
TestNG This artifact is generally always defined with a ‘test’ scope for
the integration testing framework and unit testing stubs -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</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.2</version>
</dependency>
<!-- 导入Mysql数据库链接jar包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<!-- 日志记录依赖包,很多都依赖此包,像log4j,json-lib等等 -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- JSTL标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 日志文件管理包 -->
<!-- 格式化对象,方便输出日志 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.41</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>
<!-- log end -->
<!-- jackson 包 start-->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.11</version>
</dependency>
<!-- jackson 包 结束-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>lightnote</finalName>
</build>
</project>
整体的结构图
具体代码可以到我的github仓库上找到。
谢谢大家,今天就写到这,接下来我继续做项目去了
- 在github上搭建ssm项目,记录轻笔记项目的完成进度
- 在github上搭建ssm项目,记录轻笔记项目的完成进度
- github上优秀的ssm项目
- github上搭建项目
- SSM的项目搭建
- 如何使用github客户端在github上搭建项目?
- 如何在github搭建自己的项目
- 第一个在github上的项目
- 关于Textview在github上的项目
- 在github上添加自己的项目
- ssm项目的简单搭建
- 基于SSM的项目搭建
- github上的项目
- 在github上管理项目
- 在GitHub上管理项目
- 在GitHub上管理项目
- 在github上新建项目
- 项目进度2: 已完成NFS搭建,以及对之前一些问题的思考
- leetcode--107. Binary Tree Level Order Traversal II
- linux驱动---等待队列、工作队列、Tasklets
- 教你如何找到导致程序跑飞的指令
- LeetCode 128. Longest Consecutive Sequence
- jsp配合java文件实现用户登录程序
- 在github上搭建ssm项目,记录轻笔记项目的完成进度
- G - Tian Ji -- The Horse Racing
- 快速排序java
- 上白泽慧 洛谷1726 强连通分量
- 二叉树知识点总结
- TabLayout+ViewPager 实现 PagerIndictor
- Spring aop execution 表达式
- JDBC使用Dao工厂模式读取properties配置文件实现解耦
- 多个 ng-app 中 Controllers & Services 之间的通信