原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11608581.html

 

乐观锁适用于读多写少的应用场景 

乐观锁Version图示

MySQL使用版本号实现乐观锁

 

Project Directory

MySQL使用版本号实现乐观锁

 

Maven Dependency

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
 3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 5     <modelVersion>4.0.0</modelVersion>
 6 
 7     <groupId>HelloSpring</groupId>
 8     <artifactId>org.fool.spring</artifactId>
 9     <version>1.0-SNAPSHOT</version>
10 
11     <parent>
12         <groupId>org.springframework.boot</groupId>
13         <artifactId>spring-boot-starter-parent</artifactId>
14         <version>1.5.22.RELEASE</version>
15     </parent>
16 
17     <dependencies>
18         <dependency>
19             <groupId>org.springframework.boot</groupId>
20             <artifactId>spring-boot-starter-web</artifactId>
21             <exclusions>
22                 <exclusion>
23                     <groupId>org.springframework.boot</groupId>
24                     <artifactId>spring-boot-starter-tomcat</artifactId>
25                 </exclusion>
26             </exclusions>
27         </dependency>
28         <dependency>
29             <groupId>org.springframework.boot</groupId>
30             <artifactId>spring-boot-starter-jetty</artifactId>
31             <exclusions>
32                 <exclusion>
33                     <groupId>org.eclipse.jetty.websocket</groupId>
34                     <artifactId>websocket-server</artifactId>
35                 </exclusion>
36                 <exclusion>
37                     <groupId>org.eclipse.jetty.websocket</groupId>
38                     <artifactId>javax-websocket-server-impl</artifactId>
39                 </exclusion>
40             </exclusions>
41         </dependency>
42 
43         <dependency>
44             <groupId>org.mybatis.spring.boot</groupId>
45             <artifactId>mybatis-spring-boot-starter</artifactId>
46             <version>1.3.5</version>
47         </dependency>
48 
49         <dependency>
50             <groupId>com.alibaba</groupId>
51             <artifactId>druid-spring-boot-starter</artifactId>
52             <version>1.1.20</version>
53         </dependency>
54 
55         <dependency>
56             <groupId>mysql</groupId>
57             <artifactId>mysql-connector-java</artifactId>
58         </dependency>
59 
60         <dependency>
61             <groupId>org.springframework.boot</groupId>
62             <artifactId>spring-boot-starter-test</artifactId>
63             <scope>test</scope>
64         </dependency>
65 
66         <dependency>
67             <groupId>org.mybatis.generator</groupId>
68             <artifactId>mybatis-generator-core</artifactId>
69             <version>1.3.7</version>
70             <scope>test</scope>
71         </dependency>
72     </dependencies>
73 
74     <build>
75         <plugins>
76             <plugin>
77                 <groupId>org.springframework.boot</groupId>
78                 <artifactId>spring-boot-maven-plugin</artifactId>
79             </plugin>
80             <plugin>
81                 <groupId>org.mybatis.generator</groupId>
82                 <artifactId>mybatis-generator-maven-plugin</artifactId>
83                 <version>1.3.7</version>
84                 <configuration>
85                     <configurationFile>sql/generatorConfig.xml</configurationFile>
86                     <verbose>true</verbose>
87                     <overwrite>true</overwrite>
88                 </configuration>
89             </plugin>
90         </plugins>
91     </build>
92 </project>
View Code

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-11-12
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
相关资源
相似解决方案