分类 默认分类 下的文章

通俗的解释一下多线程

多线程用于堆积处理,就像一个大土堆,一个推土机很慢,那么10个推土机一起来处理,当然速度就快了,不过由于位置的限制,如果20个推土机,那么推土机之间会产生相互的避让,相互摩擦,相互拥挤,反而不如10个处理的好,所以,多线程处理,线程数要开的恰当,就可以提高效率。

- 阅读剩余部分 -

今天碰见一个版本冲突问题具体冲突如下:

An attempt was made to call a method that does not exist.
The attempt was made from the following location:

com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.getLanguageDriver
(MybatisMapperAnnotationBuilder.java:369)

The following method did not exist:

com.baomidou.mybatisplus.core.MybatisConfiguration.getLanguageDriver
(Ljava/lang/Class;)Lorg/apache/ibatis/scripting/LanguageDriver;

The method's class, com.baomidou.mybatisplus.core.MybatisConfiguration,
is available from the following locations:
当时的spirngboot版本和mybatis版本如下:(这是修改以后又重新指定了一下mybatis的版本指定为最新版本的了。)

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.7.RELEASE</version>
    <relativePath/>
</parent>
<!--定义版本-->
<properties>
  <mybatis.plus.starter.version>3.1.1</mybatis.plus.starter.version>
</properties>
<!--解决myabatis版本冲突问题-->
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>${mybatis.plus.starter.version}</version>

</dependency>
是这个方法找不到,然后我就添加了如下配置:(最后解决问题)
<parent>

    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.7.RELEASE</version>
    <relativePath/>
</parent>

<!--定义版本-->
<properties>
  <mybatis.plus.starter.version>3.1.1</mybatis.plus.starter.version>
</properties>

        <!--解决myabatis版本冲突问题-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${mybatis.plus.starter.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>mybatis</artifactId>
                    <groupId>org.mybatis</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.6</version>
        </dependency>

mybatis中大于等于小于等于的写法,一般有以下两种。

第一种写法:(推荐使用) 在Mybatis xml中使用XML语法

大于等于

<![CDATA[ >= ]]>

小于等于

<![CDATA[ <= ]]>

例如:sql如下:

create_date_time <![CDATA[ >= ]]> #{startTime} and  create_date_time <![CDATA[ <= ]]> #{endTime}

第二种写法

原符号 < <= > >= & ' "

替换符号 &lt; &lt;= &gt; &gt;= &amp; &apos; &quot;

微信截图_20221125081717.png

例如:sql如下:

create_date_time &gt;= #{startTime} and  create_date_time &lt;= #{endTime}

编程的时候经常发现我们需要使用的端口被别的程序占用,这个时候需要清楚查看是哪个程序占用了端口,用且清除了这个进程!

1、开始---->运行---->cmd,或者是window+R组合键,调出命令窗口:

2、输入命令:netstat -ano,列出所有端口的情况。在列表中我们观察被占用的端口,比如是8080,首先找到它:

3、查看被占用端口对应的PID,输入命令:netstat -aon|findstr "8080",回车,记下最后一位数字,即PID,这里是2668。

duan.png

4、继续输入tasklist|findstr "2668",回车,查看是哪个进程或者程序占用了2668端口,结果是:java.exe

5、或者是我们打开任务管理器,点击查看--->选择列,将PID(进程标示符)前面的勾打上,点击确定。

切换到进程选项卡,在PID一列查看2668对应的进程,如下图:

6、结束该进程:在任务管理器中选中该进程点击”结束进程“按钮,或者是在cmd的命令窗口中输入:

taskkill /f /t /im java.exe。

注:后两步可以使用任务管理器,因为看的比较直观而且方便。

命令行工具;可以将下面代码保存为kill.bat文件。双击该文件。出现下方界面。方便快捷

微信截图_20230625082417.png

@echo off & setlocal EnableDelayedExpansion
CHCP 65001
CLS
echo 请输入程序正在运行的端口号
set /p port=
echo 找到的进程记录
echo =================================================================================
netstat -nao|findstr !port!
echo =================================================================================
echo 回车进行逐个确认
pause
for /f "tokens=2,5" %%i in ('netstat -nao^|findstr :%%port%%') do (
    ::if "!processed[%%j]!" == "" (
    if not defined processed[%%j] (
        set pname=N/A
        for /f "tokens=1" %%p in ('tasklist^|findstr %%j') do (set pname=%%p)
        echo %%i    %%j    !pname!
        echo 输入Y确认Kill,否则跳过,可回车跳过
        set flag=N/A
        set /p flag=
        if "!flag!" == "Y" (
            taskkill /pid %%j -t -f
        ) else (
            echo 已跳过
        )
        set processed[%%j]=1
    )
)
echo 程序结束