三更灯火五更鸡,正是男儿读书时。 黑发不知勤学早,白首方悔读书迟。
立志,标定人生方向;奋斗,创造人生价值,二者相辅相成,互相促进。
大部分程序员的**「 目标 」都是成为一名优秀的工程师,一名可以统览全局的「 架构师 」**。
对于大部分普通人而言,成为一名优秀的架构师还是有一定难度的,「 千里之行始于足下,一步一个脚印,慢慢来 」。
很多小伙伴私下问我,没有实际的开发经验,自学成才、或者是培训班出来的,简历上的项目经验怎么写?我觉得可以简简单单的写一个SSM整合项目。
目录
立志存高远,笃行践初心?
千里之行始于足下?
亿级流量Java高并发与网络编程实战?
一、Spring思维导图
二、Spring
1、基本概念
2、Spring的流程图
3、spring的优点
4、spring的缺点
三、SpringMVC
1、基本概念
2、SpringMVC的优点
3、SpringMVC的缺点
四、mybatis
1、基本概念
2、mybatis的优点
五、前置知识总结
六、Java程序员简历上的第一个项目
Spring、SpringMVC、MyBatis整合
1、大体框架
?2、引入jar包
?3、配置
4、编写代码
5、运行
spring是一个开源开发框架,是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架。
spring主要用来开发java应用,构建J2EE平台的web应用。其核心就是提供一种新的机制管理业务对象及其依赖关系。
解析:上面是在Struts结构图的基础上加入了spring流程图,在web.xml配置文件中加入了spring的监听器,在struts.xml配置文件中添加
是告知Struts2运行时使用spring来管理对象,spring在其中主要做的就是注入实例,所有需要类的实例都由spring管理。
容器:spring是一个容器,包含并管理对象的生命周期和配置。可以配置每个bean如何被创建,基于一个可配置原型prototype,你的bean可以创建一个单独的实例或者每次需要时都生成一个新的实例。
支持AOP:spring提供对AOP的支持,它允许将一些通用任务,如安全、事物、日志等进行集中式处理,从而提高了程序的复用性。
轻量级框架:spring是轻量级框架,其基本的版本大约2M。
控制反转:spring通过控制反转实现松耦合。对象们给他们依赖,而不是对象本身,方便解耦,简化开发。
方便程序测试:spring提供了Junit4的支持,可以通过注解方便的测试spring程序。
降低java EE API的使用难度:spring对java EE开发中非常难用的一些API(比如JDBC),都提供了封装,使这些API应用难度大大降低。
方便集成各种优秀框架:spring内部提供了对各种优秀框架(如Struts、mybatis)的直接支持。
支持声明式事务处理:只需要通过配置就可以完成对事务的管理,而无须手动编程。
属于spring框架的一部分,用来简化MVC架构的web应用程序开发。
mybatis是一个简化和实现了java数据持久层的开源框架,它抽象了大量的JDBC冗余代码,并提供了一个简单易用的API和数据库交互。
3、mybatis的缺点
Java框架总结
Spring AOP基础知识总结
Spring常用注解(绝对经典)
SpringMVC中put和post如何选择
@RequestParam、@ModelAttribute、@RequestBody的区别
mybatis常用注解(绝对经典)
【MyBatis?基础知识总结1】SQL注入
【MyBatis?基础知识总结2】MyBatis-Plus
【MyBatis?基础知识总结3】MyBatis一级缓存和二级缓存
【MyBatis 基础知识总结 4】动态sql
【MyBatis 基础知识总结 5】SqlSessionFactory和SqlSession
【MyBatis?基础知识总结6】Statement、PreparedStatement和CallableStatement
与spring整合时,mybatis的配置文件conf.xml(数据源+mapper.xml)可省,将其配置在applicationContext.xml中。
classpath:db.properties
数据库配置
driver=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
username=orcl
password=orcl
(1)entity
package com.guor.entity;
public class Student {
private int id;
private String name;
private int age;
...
}
(2)mapper
package com.guor.mapper;
import com.guor.entity.Student;
public interface StudentMapper {
public void addStudent(Student student);
public Student queryStudentByStuNo(int id);
}
StudentMapper.xml
insert into student(id,name,age) values (#{id},#{name},#{age})
(3)StudentService
package com.guor.service;
import com.guor.entity.Student;
public interface IStudentService {
public void addStudent(Student student);
public Student queryStudentByStuNo(int id);
}
StudentServiceImpl
package com.guor.service.impl;
import com.guor.entity.Student;
import com.guor.mapper.StudentMapper;
import com.guor.service.IStudentService;
public class StudentServiceImpl implements IStudentService {
private StudentMapper studentMapper;
public void setStudentMapper(StudentMapper studentMapper) {
this.studentMapper = studentMapper;
}
@Override
public void addStudent(Student student) {
studentMapper.addStudent(student);
}
@Override
public Student queryStudentByStuNo(int id) {
return studentMapper.queryStudentByStuNo(id);
}
}
(4)controller
package com.guor.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.guor.entity.Student;
import com.guor.service.IStudentService;
@Controller
@RequestMapping("studentController")
public class StudentController {
@Autowired
@Qualifier("studentService")
private IStudentService studentService;
public void setStudentService(IStudentService studentService) {
this.studentService = studentService;
}
@RequestMapping("queryStudentByStuNo/{id}")//映射
public String queryStudentByStuNo(@PathVariable("id") Integer id,Map map) {
Student student = studentService.queryStudentByStuNo(id);
map.put("student", student);
return "result";
}
}
(5)配置文件
text/html;charset=UTF-8
error
error
3、index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
Insert title here
queryStudentByStuNo
?? Java学习路线思维导图:Java学习路线思维导图
?? Java学习路线配套文章:搬砖工逆袭Java架构师
?? Java经典面试题大全:10万字208道Java经典面试题总结(附答案)
?? 简介:Java领域优质创作者??、CSDN哪吒公众号作者 、Java架构师奋斗者??
?? 扫描主页左侧二维码,加入群聊,一起学习、一起进步
?? 欢迎点赞 ?? 收藏 留言 ??
添加微信,备注1024,赠送Java学习路线思维导图