亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

2020最新版SSM框架整合教程

 更新時(shí)間:2020年09月22日 08:58:44   作者:Baret H ~  
這篇文章主要介紹了2020最新版SSM框架整合教程,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

實(shí)驗(yàn)環(huán)境為:IDEA2020.1+MySQL8.0.21+Tomcat9.0.36+Maven3.3.9

最終項(xiàng)目結(jié)構(gòu)圖

image-20200907092115586

一、搭建數(shù)據(jù)庫(kù)環(huán)境

創(chuàng)建一個(gè)存放書(shū)籍?dāng)?shù)據(jù)的數(shù)據(jù)庫(kù)表

CREATE DATABASE `ssmbuild`;

USE `ssmbuild`;

DROP TABLE IF EXISTS `books`;

CREATE TABLE `books` (
`bookID` INT(10) NOT NULL AUTO_INCREMENT COMMENT '書(shū)id',
`bookName` VARCHAR(100) NOT NULL COMMENT '書(shū)名',
`bookCounts` INT(11) NOT NULL COMMENT '數(shù)量',
`detail` VARCHAR(200) NOT NULL COMMENT '描述',
KEY `bookID` (`bookID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8

INSERT INTO `books`(`bookID`,`bookName`,`bookCounts`,`detail`)VALUES
(1,'Java',1,'從入門(mén)到放棄'),
(2,'MySQL',10,'從刪庫(kù)到跑路'),
(3,'Linux',5,'從進(jìn)門(mén)到進(jìn)牢');

生成表格

image-20200905001342967

二、基本環(huán)境搭建

1、創(chuàng)建maven項(xiàng)目,添加web支持

image-20200905135859129 

2、導(dǎo)入依賴(lài)

<dependencies>
 <!--Junit-->
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.13</version>
 </dependency>
 <!--數(shù)據(jù)庫(kù)驅(qū)動(dòng)-->
 <dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>8.0.21</version>
 </dependency>
 <!-- 數(shù)據(jù)庫(kù)連接池:c3p0 -->
 <dependency>
  <groupId>com.mchange</groupId>
  <artifactId>c3p0</artifactId>
  <version>0.9.5.5</version>
 </dependency>

 <!--Servlet-->
 <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.5</version>
 </dependency>
 <!--JSP-->
 <dependency>
  <groupId>javax.servlet.jsp</groupId>
  <artifactId>jsp-api</artifactId>
  <version>2.2</version>
 </dependency>
 <!--jstl-->
 <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>1.2</version>
 </dependency>

 <!--Mybatis-->
 <dependency>
  <groupId>org.mybatis</groupId>
  <artifactId>mybatis</artifactId>
  <version>3.5.5</version>
 </dependency>
 <!--Mybatis-Spring-->
 <dependency>
  <groupId>org.mybatis</groupId>
  <artifactId>mybatis-spring</artifactId>
  <version>2.0.5</version>
 </dependency>

 <!--Spring-->
 <dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>5.2.8.RELEASE</version>
 </dependency>
 <!--Spring操作數(shù)據(jù)庫(kù),還需要spring-jdbc-->
 <dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jdb	c</artifactId>
  <version>5.2.6.RELEASE</version>
 </dependency>
 
 <!--lombok-->
 <dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.12</version>
 </dependency>
</dependencies>

最后為了防止maven配置文件無(wú)法被導(dǎo)出或生效,加入以下代碼

<build>
 <resources>
  <resource>
   <directory>src/main/java</directory>
   <includes>
    <include>**/*.properties</include>
    <include>**/*.xml</include>
   </includes>
   <filtering>false</filtering>
  </resource>
  <resource>
   <directory>src/main/resources</directory>
   <includes>
    <include>**/*.properties</include>
    <include>**/*.xml</include>
   </includes>
   <filtering>false</filtering>
  </resource>
 </resources>
</build>

3、建立項(xiàng)目基本結(jié)構(gòu)

image-20200907092227945

src/main/java目錄下新建以下四個(gè)包,為后續(xù)實(shí)驗(yàn)準(zhǔn)備

  • pojo:用來(lái)放實(shí)體類(lèi)
  • dao:數(shù)據(jù)訪(fǎng)問(wèn)層,data access object
  • service:服務(wù)層,調(diào)用dao層
  • controller:控制層,調(diào)用service層

三、MyBatis層編寫(xiě)

1、編寫(xiě)數(shù)據(jù)庫(kù)配置文件

在resource目錄下新建database.properties

image-20200907092540325

注意MySQL8.0以上要設(shè)置時(shí)區(qū),最后加上serverTimezone=Asia/Shanghai

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssmbuild?useSSL=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
jdbc.username=root
jdbc.password=200024

2、IDEA關(guān)聯(lián)數(shù)據(jù)庫(kù)

image-20200905002711449

時(shí)區(qū)問(wèn)題解決方案http://chabaoo.cn/article/186512.htm

set global time_zone = '+8:00'; 

打開(kāi)上述新建的數(shù)據(jù)表

image-20200905002901577

3、編寫(xiě)MyBatis核心配置文件

在resource目錄下新建mybatis-config.xml

image-20200907092439880

數(shù)據(jù)源的配置,交給后續(xù)Spring去做

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
 <!--別名-->
 <typeAliases>
  <package name="pojo"/>
 </typeAliases>
</configuration>

4、編寫(xiě)pojo實(shí)體類(lèi)

pojo包下創(chuàng)建數(shù)據(jù)庫(kù)表所對(duì)應(yīng)的實(shí)體類(lèi)Books,這里使用了lombok插件

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Books {
  private int bookID;
  private String bookName;
  private int bookCounts;
  private String detail;
}

5、編寫(xiě)dao層

image-20200907092605602 

1. 編寫(xiě)Mapper接口

dao包下新建BookMapper接口,編寫(xiě)增刪改查四種業(yè)務(wù)對(duì)應(yīng)的方法

public interface BookMapper {
  //增加一本書(shū)
  int addBook(Books books);

  //刪除一本書(shū)
  //@Param注解指定傳入?yún)?shù)的名稱(chēng)
  int deleteBookByID(@Param("bookID") int id);

  //更新一本書(shū)
  int updateBook(Books books);

  //查詢(xún)一本書(shū)
  //@Param注解指定傳入?yún)?shù)的名稱(chēng)
  Books queryByID(@Param("bookID") int id);

  //查詢(xún)?nèi)康臅?shū)
  List<Books> queryAllBooks();
}

2. 編寫(xiě)Mapper接口對(duì)應(yīng)的Mapper.xml

一個(gè)Mapper.xml對(duì)應(yīng)一個(gè)Mapper接口,要用namespace綁定上述接口

實(shí)現(xiàn)上述接口里的所有方法

<?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="dao.BookMapper">
  <!--增加一本書(shū)-->
  <insert id="addBook" parameterType="pojo.Books">
    insert into ssmbuild.books(bookName,bookCount,detail)
    values (#{bookName},#{bookCount},#{detail})
  </insert>
  
  <!--刪除一本書(shū)-->
  <delete id="deleteBookByID" parameterType="int">
    delete from ssmbuild.books where bookID=#{bookID}
  </delete>
  
   <!--更新一本書(shū)-->
  <update id="updateBook" parameterType="pojo.Books">
    update ssmbuild.books set
    bookName=#{bookName},bookCounts=#{bookCounts},detail=#{detail}
    where bookID=#{bookID} ;
  </update>

   <!--查詢(xún)一本書(shū)-->
  <select id="queryByID" resultType="pojo.Books">
    select * from ssmbuild.books where bookID=#{bookID}
  </select>

   <!--查詢(xún)所有書(shū)-->
  <select id="queryAllBooks" resultType="pojo.Books">
    select * from ssmbuild.books
  </select>
</mapper>

然后到mybatis核心配置文件中注冊(cè)上述mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
  <!--別名-->
  <typeAliases>
    <package name="pojo"/>
  </typeAliases>
  
  <!--注冊(cè)mapper-->
  <mappers>
  	<mapper class="dao.BookMapper"/>
	</mappers>
</configuration>

6、編寫(xiě)service層

image-20200907092627828 

1. 編寫(xiě)service層的接口

service包下新建BookService接口,同Mapper接口里的方法一致

package service;

import pojo.Books;
import java.util.List;

public interface BookService {
  //增加一本書(shū)
  int addBook(Books books);

  //刪除一本書(shū)
  int deleteBookByID(int id);

  //更新一本書(shū)
  int updateBook(Books books);

  //查詢(xún)一本書(shū)
  Books queryByID(int id);

  //查詢(xún)?nèi)康臅?shū)
  List<Books> queryAllBooks();
}

2. 編寫(xiě)service層接口實(shí)現(xiàn)類(lèi)

然后再service包下新建上述接口的實(shí)現(xiàn)類(lèi)BookServiceImpl

service層用來(lái)調(diào)用dao層,所以?xún)?nèi)置私有屬性為dao層的Mapper接口對(duì)象

package service;

import pojo.Books;
import java.util.List;

public interface BookService {
  //增加一本書(shū)
  int addBook(Books books);

  //刪除一本書(shū)
  int deleteBookByID(int id);

  //更新一本書(shū)
  int updateBook(Books books);

  //查詢(xún)一本書(shū)
  Books queryByID(int id);

  //查詢(xún)?nèi)康臅?shū)
  List<Books> queryAllBooks();
}

四、Spring層編寫(xiě)

1、Spring整合dao層

在resource目錄下新建spring-dao.xml

image-20200907092655386

關(guān)聯(lián)數(shù)據(jù)庫(kù)配置文件database.properties,要引入context約束

配置MyBatis數(shù)據(jù)源,這里使用第三方的c3p0,還可以附加一些私有屬性

image-20200906124914041

創(chuàng)建sqlSessionFactory,在 MyBatis-Spring 中,則使用 SqlSessionFactoryBean 來(lái)創(chuàng)建,要配置兩個(gè)重要屬性

  • configLocation綁定MyBatis核心配置文件
  • dataSource指定數(shù)據(jù)源(必要

配置自動(dòng)掃描包dao,動(dòng)態(tài)實(shí)現(xiàn)了dao層接口可以注入到Spring容器中

(在原來(lái)我們是創(chuàng)建sqlSessionTemplate對(duì)象,然后再創(chuàng)建一個(gè)Mapper接口實(shí)現(xiàn)類(lèi),其中內(nèi)置sqlSessionTemplate私有對(duì)象,通過(guò)該對(duì)象進(jìn)行操作)

<?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

  <!--1.關(guān)聯(lián)數(shù)據(jù)庫(kù)配置文件-->
  <context:property-placeholder location="classpath:database.properties"/>

  <!--2.數(shù)據(jù)庫(kù)連接池
    		dbcp 半自動(dòng)化操作 不能自動(dòng)連接
    		c3p0 自動(dòng)化操作(自動(dòng)的加載配置文件 并且設(shè)置到對(duì)象里面)
    		druid、hikari-->
  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <!--配置連接池屬性,使用了EL表達(dá)式-->
    <property name="driverClass" value="${jdbc.driver}"/>
    <property name="jdbcUrl" value="${jdbc.url}"/>
    <property name="user" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
    
    <!-- c3p0連接池的私有屬性 -->
    <property name="maxPoolSize" value="30"/>
    <property name="minPoolSize" value="10"/>
    <!-- 關(guān)閉連接后不自動(dòng)commit -->
    <property name="autoCommitOnClose" value="false"/>
    <!-- 獲取連接超時(shí)時(shí)間 -->
    <property name="checkoutTimeout" value="10000"/>
    <!-- 當(dāng)獲取連接失敗重試次數(shù) -->
    <property name="acquireRetryAttempts" value="2"/>
  </bean>

  <!--3.sqlSessionFactory-->
  <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <!--引用上述數(shù)據(jù)源-->
    <property name="dataSource" ref="dataSource"/>
    <!--綁定MyBatis配置文件-->
    <property name="configLocation" value="classpath:mybatis-config.xml"/>
  </bean>

  <!--4.配置dao接口掃描包,動(dòng)態(tài)實(shí)現(xiàn)了Dao接口可以注入到Spring容器中-->
  <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!--注入sqlSessionFactory-->
    <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
    <!--要掃描的dao包-->
    <property name="basePackage" value="dao"/>
  </bean>
</beans>

2、Spring整合service層

在resource目錄下新建spring-service.xml

image-20200907092714987

配置掃描service包,使該包下的注解生效

將所有業(yè)務(wù)類(lèi)注入到Spring

配置聲明式事務(wù),需要注入數(shù)據(jù)源

<?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
  
  <!--1.掃描service下的包,這個(gè)包下的注解就會(huì)生效-->
  <context:component-scan base-package="service"/>

  <!--將所有的業(yè)務(wù)類(lèi)注入到Spring,可以通過(guò)配置或者注解實(shí)現(xiàn)-->
  <bean id="BookServiceImpl" class="service.BookServiceImpl">
    <!--這里的ref指向spring-dao.xml最后Spring注入的dao接口-->
    <property name="bookMapper" ref="bookMapper"/>
  </bean>

  <!--聲明式事務(wù)配置-->
  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <!--注入數(shù)據(jù)源-->
    <property name="dataSource" ref="dataSource"/>
  </bean>

</beans>

五、SpringMVC層編寫(xiě)

1、編寫(xiě)spring-mvc.xml

image-20200907092735743 

自動(dòng)掃描包

過(guò)濾靜態(tài)資源

支持mvc注解驅(qū)動(dòng)

視圖解析器

<?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:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    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.xsd 
    http://www.springframework.org/schema/context
    https://www.springframework.org/schema/context/spring-context.xsd">

  <!--開(kāi)啟SpringMVC注解驅(qū)動(dòng)-->
  <mvc:annotation-driven/>
  
  <!--靜態(tài)資源過(guò)濾-->
  <mvc:default-servlet-handler/>
  
  <!--掃描包c(diǎn)ontroller-->
  <context:component-scan base-package="controller"/>

  <!--視圖解析器-->
  <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp"/>
  </bean>
</beans>

2、Spring配置文件整合

image-20200907092812107

applicationContext.xml導(dǎo)入上述配置文件,作為整體的配置文件

<?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">

  <import resource="spring-dao.xml"/>
  <import resource="spring-service.xml"/>
  <import resource="spring-mvc.xml"/>

</beans>

3、配置web.xml

image-20200907092837381 

  • 注冊(cè)DispatcherServlet,需要綁定SpringMVC配置文件,這里一定要綁定整體的配置文件applicationContext.xml,并設(shè)置啟動(dòng)級(jí)別
  • 增加亂碼過(guò)濾
  • 設(shè)置session過(guò)期時(shí)間
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
     version="4.0">

  <!--DispatcherServlet-->
  <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:applicationContext.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

  <!--亂碼過(guò)濾-->
  <filter>
    <filter-name>encodingFilter</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>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!--session過(guò)期時(shí)間-->
  <session-config>
    <session-timeout>15</session-timeout>
  </session-config>
</web-app>

4、編寫(xiě)Controller

controller包下新建BookController類(lèi)

image-20200907092858032

@Controller
@RequestMapping("/book")
public class BookController {
  //controller層調(diào)用service層
  @Autowired
  @Qualifier("BookServiceImpl")
  private BookService bookService;

  //查詢(xún)?nèi)繒?shū)籍,并且返回到一個(gè)頁(yè)面進(jìn)行顯示
  @RequestMapping("/allBooks")
  public String list(Model model) {
    List<Books> books = bookService.queryAllBooks();
    model.addAttribute("list", books);
    return "allBooks";
  }
}

5、編寫(xiě)視圖層

web/WEB-INF/目錄下新建jsp包,用來(lái)存放我們自定義視圖頁(yè)面

image-20200907092928877

1. 編寫(xiě)index.jsp

超鏈接跳轉(zhuǎn)到我們自定的展示所有書(shū)籍頁(yè)面allBooks.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>首頁(yè)</title>
</head>
<body>
<h5>
  <a href="${pageContext.request.contextPath}/book/allBooks">進(jìn)入書(shū)籍頁(yè)面</a>
</h5>
</body>
</html>

2. 編寫(xiě)展示所有書(shū)籍頁(yè)面allBooks.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>全部書(shū)籍展示</title>
</head>
<body>
<h1>全部書(shū)籍展示</h1>
${list}
</body>
</html>

6、運(yùn)行測(cè)試

配置Tomcat啟動(dòng)測(cè)試,記得添加lib目錄,否則Tomcat啟動(dòng)不來(lái)

image-20200906214851091

啟動(dòng)Tomcat后,默認(rèn)進(jìn)入的index.jsp

image-20200906183814837

然后我們點(diǎn)擊超鏈接

image-20200906235549567

成功顯示了我們的所有書(shū)籍!

到此位置,SSM整合項(xiàng)目到此結(jié)束,后續(xù)大家可以自己實(shí)現(xiàn)相關(guān)業(yè)務(wù)?。?!

到此這篇關(guān)于2020最新版SSM框架整合教程的文章就介紹到這了,更多相關(guān)SSM框架整合內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Spring?Boot?利用?XML?方式整合?MyBatis

    Spring?Boot?利用?XML?方式整合?MyBatis

    這篇文章主要介紹了Spring?Boot?利用?XML?方式整合?MyBatis,文章圍繞主題的相關(guān)資料展開(kāi)詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,組要的小伙伴可以參考一下
    2022-05-05
  • SpringBoot上傳圖片與視頻不顯示問(wèn)題的解決方案

    SpringBoot上傳圖片與視頻不顯示問(wèn)題的解決方案

    這篇文章主要介紹了關(guān)于springboot上傳圖片與視頻不顯示問(wèn)題,最近做畢設(shè)時(shí)候需要上傳視頻的圖片與視頻,但是每次都需要重啟前端才能展示出此圖片,所以本文給大家介紹了SpringBoot上傳圖片與視頻不顯示問(wèn)題的解決方案,需要的朋友可以參考下
    2024-03-03
  • java實(shí)現(xiàn)圖形卡片排序游戲

    java實(shí)現(xiàn)圖形卡片排序游戲

    這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)圖形卡片排序游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-07-07
  • Spring Cloud Alibaba Nacos Config配置中心實(shí)現(xiàn)

    Spring Cloud Alibaba Nacos Config配置中心實(shí)現(xiàn)

    這篇文章主要介紹了Spring Cloud Alibaba Nacos Config配置中心實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-04-04
  • Java中的switch新特性與使用詳解

    Java中的switch新特性與使用詳解

    這篇文章主要介紹了Java中的switch新特性與使用詳解,Switch語(yǔ)句可以實(shí)現(xiàn)根據(jù)某一變量選則執(zhí)行代碼塊,當(dāng)然直接使用If語(yǔ)句也可以做到,但是有時(shí)候使用Switch語(yǔ)句往往更加簡(jiǎn)潔優(yōu)美,需要的朋友可以參考下
    2023-11-11
  • Spring Boot 快速入門(mén)指南

    Spring Boot 快速入門(mén)指南

    Spring 框架是非常著名的 Java 開(kāi)源框架,歷經(jīng)十多年的發(fā)展,整個(gè)生態(tài)系統(tǒng)已經(jīng)非常完善甚至是繁雜,Spring Boot 正是為了解決這個(gè)問(wèn)題而開(kāi)發(fā)的,為 Spring 平臺(tái)和第三方庫(kù)提供了開(kāi)箱即用的設(shè)置,只需要很少的配置就可以開(kāi)始一個(gè) Spring 項(xiàng)目
    2017-03-03
  • Java基本數(shù)據(jù)類(lèi)型和運(yùn)算符詳解

    Java基本數(shù)據(jù)類(lèi)型和運(yùn)算符詳解

    這篇文章主要介紹了Java基本數(shù)據(jù)類(lèi)型和運(yùn)算符,結(jié)合實(shí)例形式詳細(xì)分析了java基本數(shù)據(jù)類(lèi)型、數(shù)據(jù)類(lèi)型轉(zhuǎn)換、算術(shù)運(yùn)算符、邏輯運(yùn)算符等相關(guān)原理與操作技巧,需要的朋友可以參考下
    2020-02-02
  • @CacheEvict中的allEntries與beforeInvocation的區(qū)別說(shuō)明

    @CacheEvict中的allEntries與beforeInvocation的區(qū)別說(shuō)明

    這篇文章主要介紹了@CacheEvict中的allEntries與beforeInvocation的區(qū)別說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-12-12
  • Mybatis的入門(mén)示例代碼

    Mybatis的入門(mén)示例代碼

    首先新建一個(gè)JavaWeb項(xiàng)目并導(dǎo)入mybatis依賴(lài)的jar包,同時(shí)Mybatis是對(duì)數(shù)據(jù)庫(kù)的操作所以我們需要在數(shù)據(jù)庫(kù)中新建一個(gè)表user用來(lái)演示。下面通過(guò)本文給大家詳細(xì)介紹Mybatis的入門(mén)示例代碼,感興趣的朋友一起看看吧
    2016-11-11
  • Java中的自定義異常捕獲方式

    Java中的自定義異常捕獲方式

    這篇文章主要介紹了Java中的自定義異常捕獲方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-08-08

最新評(píng)論