####Java中的String,StringBuilder,StringBuffer三者的区别
最近在学习Java的时候,遇到了这样一个问题,就是String,StringBuilder以及StringBuffer这三个类之间有什么区别呢,自己从网上搜索了一些资料,有所了解了之后在这里整理一下,便于大家观看,也便于加深自己学习过程中对这些知识点的记忆,如果哪里有误,恳请指正.
#####这三个类之间的区别主要是在两个方面,即运行速度和线程安全这两方面
####Java中的String,StringBuilder,StringBuffer三者的区别
最近在学习Java的时候,遇到了这样一个问题,就是String,StringBuilder以及StringBuffer这三个类之间有什么区别呢,自己从网上搜索了一些资料,有所了解了之后在这里整理一下,便于大家观看,也便于加深自己学习过程中对这些知识点的记忆,如果哪里有误,恳请指正.
#####这三个类之间的区别主要是在两个方面,即运行速度和线程安全这两方面
踩坑: mybatis-config.xml mysql.properties UserMapper.xml 等配置文件都必须放在 resources 下
##0. 前期环境准备:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 父工程 -->
<groupId>com.wgymt</groupId>
<artifactId>Mybatis-Study</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>mybatis-01</module>
</modules>
<!-- 导入依赖 -->
<dependencies>
<!-- MySQL 驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<!-- MyBatis 驱动-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- 在 build 中配置 resources, 防止资源导出失败问题 -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>##1. 使用 mybatis 第一步 创建工具类:
文件路径: Mybatis-Study/mybatis-01/src/main/java/com/wgymt/utils/MybatisUtils.java
说明:
{
"coc.preferences.formatOnInsertLeave": true,
"coc.preferences.formatOnSaveFiletypes": [
"json",
"python",
"javascript",
"go"
],
"python.jediEnabled": false,
"python.formatting.provider": "autopep8",
"python.linting.enabled": true,
"languageserver": {
"golang": {
"command": "/home/ubuntu/go/bin/gopls",
"rootPatterns": [
"go.mod",
".vim/",
".git/",
".hg/"
],
"filetypes": [
"go"
]
},
"python": {
"command": "python3",
"args": [
"-mpyls",
"-vv",
"--log-file",
"/tmp/lsp_python.log"
],
"trace.server": "verbose",
"filetypes": [
"python"
],
"settings": {
"pyls": {
"enable": true,
"trace": {
"server": "verbose"
},
"commandPath": "",
"configurationSources": [
"pycodestyle"
],
"plugins": {
"jedi_completion": {
"enabled": true
},
"jedi_hover": {
"enabled": true
},
"jedi_references": {
"enabled": true
},
"jedi_signature_help": {
"enabled": true
},
"jedi_symbols": {
"enabled": true,
"all_scopes": true
},
"mccabe": {
"enabled": true,
"threshold": 15
},
"preload": {
"enabled": true
},
"pycodestyle": {
"enabled": true
},
"pydocstyle": {
"enabled": false,
"match": "(?!test_).*\\.py",
"matchDir": "[^\\.].*"
},
"pyflakes": {
"enabled": true
},
"rope_completion": {
"enabled": true
},
"yapf": {
"enabled": true
}
}
}
}
}
}
}