Git
项目初始化
在study文件下创建一个git,名字叫blog
mkdir study
cd study
git init blog
其他参数
--initial-branch 初始化的分支
--bare 创建一个裸仓库(纯 Git 目录,没有工作目录)
--template 可以通过模板来创建预先构建好的自定义 git 目录
Git Config
不同级别的 Git 配置
在study文件下创建一个git,名字叫blog
mkdir study
cd study
git init blog
其他参数
--initial-branch 初始化的分支
--bare 创建一个裸仓库(纯 Git 目录,没有工作目录)
--template 可以通过模板来创建预先构建好的自定义 git 目录
不同级别的 Git 配置

版本选择

下载: Nacos Server 下载 | Nacos 官网
下载解压后在bin文件,打开cmd,输入 startup.cmd -m standalone

导入web依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
引入服务依赖发现
@SpringBootApplication
public class OrderMainApplication {
public static void main(String[] args) {
SpringApplication.run(OrderMainApplication.class, args);
}
}
修改配置文件
spring.application.name=service-order
server.port=8000
spring.cloud.nacos.server-addr=127.0.0.1:8848
启动程序后即可在服务列表中查看

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<junit.version>5.9.2</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.2.1</version>
</dependency>
</dependencies>

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<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:springmvc-servlet.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>
</web-app>
springmvc-servlet.xml
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.1.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.1.12</version>
</dependency>
</dependencies>
<?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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>
<bean id="hello" class="org.example.pojo.HelloWorld"/>
<bean id="hello" class="org.example.pojo.HelloWorld">
<constructor-arg name="message" value="Hello World!"/>
</bean>
<bean id="hello" class="org.example.pojo.HelloWorld">
<property name="message" value="Hello World!"/>
</bean>
<import resource="其他Spring配置文件.xml"/>
导入的配置文件和本身共有注册 bean,优先用自己的
Mybatis是一个持久层的框架,支持自定义 SQL、存储过程以及高级映射。MyBatis 免除了几乎所有的 JDBC 代码以及设置参数和获取结果集的工作。可以使用XML或注解来配置和映射原始类型、接口和Java对象作为数据库中的记录。
帮助文档
https://mybatis.org/mybatis-3/zh_CN/index.html
1、maven仓库
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.16</version>
</dependency>
2、GitHub
https://github.com/mybatis/mybatis-3/releases
搭建好一个环境特别麻烦,做错一步就搭建失败报错 跟着官方文档一步步来:https://mybatis.org/mybatis-3/zh_CN/getting-started.html