爆肝10000字,小白零基礎入門,簡歷上的專案經驗該怎麼寫?(建議收藏)

2021-10-16 15:00:01

立志存高遠,篤行踐初心 

三更燈火五更雞,正是男兒讀書時。 黑髮不知勤學早,白首方悔讀書遲。

立志,標定人生方向;奮鬥,創造人生價值,二者相輔相成,互相促進。

大部分程式設計師的「 目標 」都是成為一名優秀的工程師,一名可以統覽全域性的「 架構師 」

千里之行始於足下 

對於大部分普通人而言,成為一名優秀的架構師還是有一定難度的,「 千里之行始於足下,一步一個腳印,慢慢來 」

🍅 粉絲專屬福利:包郵送書3本,如下書單四選一。

🍅 獲取方式:

1、參與文末投票,點贊,收藏即有機會獲得精美圖書一本;

1、評論區評論:獲取點贊最多者,獲取一本;

2、評論區評論:通過random函數,隨機抽取兩名;

【注意】想加入微信群聊,可以掃描主頁左側二維條碼、私信與我、加本人微信guo_rui_

億級流量Java高並行與網路程式設計實戰 

1、本書從並行的底層核心技術、網際網路應用框架、資料處理等三部分對高並行系列技術做了系統講解。

2、本書以實戰化訓練為宗旨,用詳盡且經典的案例闡述了 Java巨量資料及高階程式設計中的重點、難點。書中案例由真實專案演化而來,既體現了所述知識點的精華,又遮蔽了無關技術的干擾。

3、案例都是以「理論講解 環境搭建 完整程式碼及分析 執行截圖」這種完善的結構進行講解,考慮到了讀者可能會遇到的各種問題。


很多小夥伴私下問我,沒有實際的開發經驗,自學成才、或者是培訓班出來的,簡歷上的專案經驗怎麼寫?我覺得可以簡簡單單的寫一個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思維導圖

二、Spring

1、基本概念

spring是一個開源開發框架,是一個輕量級控制反轉(IoC)和麵向切面(AOP)的容器框架。

spring主要用來開發java應用,構建J2EE平臺的web應用。其核心就是提供一種新的機制管理業務物件及其依賴關係。

2、Spring的流程圖

解析:上面是在Struts結構圖的基礎上加入了spring流程圖,在web.xml組態檔中加入了spring的監聽器,在struts.xml組態檔中新增   

<constant name="struts.objectFactory" value="spring" />

是告知Struts2執行時使用spring來管理物件,spring在其中主要做的就是注入範例,所有需要類的範例都由spring管理。

3、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)的直接支援。
支援宣告式事務處理:只需要通過設定就可以完成對事務的管理,而無須手動程式設計。

4、spring的缺點

  • 依賴反射,反射影響程序。
  • 太過於依賴設計模式。
  • 控制器過於靈活。
  • 不支援分散式應用。

三、SpringMVC

1、基本概念

屬於spring框架的一部分,用來簡化MVC架構的web應用程式開發。

2、SpringMVC的優點

  1. 擁有強大的靈活性,非侵入性和可設定性
  2. 提供了一個前端控制器dispatcherServlet,開發者無需額外開發控制器物件
  3. 分工明確,包括控制器、驗證器、命令物件、模型物件、處理程式對映檢視解析器,每一個功能實現由一個專門的物件負責完成
  4. 可以自動繫結使用者輸入,並正確的轉換資料型別
  5. 可重用的業務程式碼:可以使用現有的業務物件作為命令或表單物件,而不需要去擴充套件某個特定框架的基礎類別。

3、SpringMVC的缺點

  1. servlet API耦合難以脫離容器獨立執行
  2. 太過於細分,開發效率低

四、mybatis

1、基本概念

mybatis是一個簡化和實現了java資料持久層的開源框架,它抽象了大量的JDBC冗餘程式碼,並提供了一個簡單易用的API和資料庫互動。

2、mybatis的優點

  1. 與JDBC相比,減少了50%以上的程式碼量。
  2. mybatis是最簡單的持久化框架,小巧並且簡單易學。
  3. mybatis靈活,不會對應用程式或者資料庫的限售設計強加任何影響,SQL寫在XML裡,從程式程式碼中徹底分離,降低耦合度,便於統一管理和優化,可重用。
  4. 提供XML標籤,支援編寫動態SQL語句(XML中使用if,else)。
  5. 提供對映標籤,支援物件與資料庫的ORM欄位關係對映(在XML中設定對映關係,也可以使用註解)

3、mybatis的缺點

  1. SQL語句的編寫工作量較大,對開發人員的SQL語句編寫有一定的水平要求。
  2. SQL語句過於依賴資料庫,不能隨意更換資料庫。
  3. 拼接複雜SQL語句時不靈活。

五、前置知識總結

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

六、Java程式設計師簡歷上的第一個專案

Spring、SpringMVC、MyBatis整合

1、大體框架

 2、引入jar包

 3、設定

與spring整合時,mybatis的組態檔conf.xml(資料來源+mapper.xml)可省,將其設定在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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
	<bean id="config" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
		<property name="locations">
			<array>
				<value>classpath:db.properties</value>
			</array>
		</property>
	</bean>
 
	<!-- 設定資料庫資訊(替代mybatis的組態檔confx.ml)   -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
	</bean> 
	
	<!-- 在springIOC中建立mybatis的核心類SqlSessionFactoryBean  -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"></property>
		<property name="mapperLocations" value="classpath:com/guor/mapper/*.xml"></property>
	</bean> 
 
	<bean id="studentService" class="com.guor.service.impl.StudentServiceImpl">
		<property name="studentMapper" ref="studentMapper"></property>
	</bean>
	
	<!-- 批次產生mapper物件在IOC中的id值預設就是介面名-->
	<bean id="mappers" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>  
		<!-- 指定批次產生哪個包的mapper物件 -->
		<property name="basePackage" value="com.guor.mapper"></property>  
	</bean>
</beans>

資料庫設定 

driver=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
username=orcl
password=orcl

4、編寫程式碼

(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

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.guor.mapper.StudentMapper">
	<select id="queryStudentByStuNo" parameterType="int" resultType="com.guor.entity.Student">
		select * from student where id = #{stuNo}
	</select>
	
	<insert id="addStudent" parameterType="com.guor.entity.Student">
		insert into student(id,name,age) values (#{id},#{name},#{age})
	</insert>
</mapper>

 (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<String,Object> map) {
		Student student = studentService.queryStudentByStuNo(id);
		map.put("student", student);
		return "result";
	}
}

(5)組態檔

<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx.xsd">
	
	<!-- 掃描有註解的包 -->
	<context:component-scan base-package="com.guor.controller"></context:component-scan>
	
	<!-- 設定檢視解析器(InternalResourceViewResolver) -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/views/"></property>
		<property name="suffix" value=".jsp"></property>
	</bean>
	
	<!-- springMVC基礎設定、標配 -->
	<mvc:annotation-driven></mvc:annotation-driven>
	
	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<ref bean="mappingJacksonHttpMessageConverter" />
			</list>
		</property>
	</bean>
	<bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>text/html;charset=UTF-8</value>
			</list>
		</property>
	</bean>
	
	<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
		<!-- <property name="exceptionAttribute" value = "ex"></property> 異常變數的預設值是exception-->
		<property name="exceptionMappings">
			<props>
				<!-- 相當於catch -->
				<prop key="java.lang.ArithmeticException">
					error
				</prop>
				<prop key="java.lang.NullPointException">
					error
				</prop>
			</props>
		</property>
	</bean>
</beans>

3、index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<a href="studentController/queryStudentByStuNo/3">queryStudentByStuNo</a>
</body>
</html>

5、執行

🏀 Java學習路線思維導圖:Java學習路線思維導圖

🏀 Java學習路線配套文章:搬磚工逆襲Java架構師

🏀 Java經典面試題大全:10萬字208道Java經典面試題總結(附答案)

🏀 簡介:Java領域優質創作者🏆、CSDN哪吒公眾號作者✌ 、Java架構師奮鬥者💪

🏀 掃描主頁左側二維條碼,加入群聊,一起學習、一起進步 

🏀 歡迎點贊 👍 收藏 ⭐留言 📝