分类 IT生活 下的文章

在application.yml配置如下

mybatis:
    // 实体类位置(可以在mapper文件中,不写配置)
    type-aliases-package: com.sskj.entity
    // 配置文件(如果启动外界配置,就不能启动configuration)
    config-location: classpath:mybatis/mybatis-config.xml
    // 映射文件
    mapper-locations: classpath:mybatis/mapper/*.xml

配置文件

xml文件的声明

<!DOCTYPE configuration
    PUBLIC "-//mybatis.org//DTD config 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    
</configuration>

配置参考
https://mybatis.org/mybatis-3/zh/configuration.html

mapper文件

xml文件的声明

<!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper>
    
</mapper>

通过curl获取(任选其中之一)

curl cip.cc
curl ipinfo.io
curl myip.ipip.net
curl http://members.3322.org/dyndns/getip
curl https://ip.cn
curl httpbin.org/ip
curl ip.sb
curl whatismyip.akamai.com
curl ipecho.net/plain
curl icanhazip.com
 
# 淘宝
curl -s  http://ip.taobao.com/service/getIpInfo2.php?ip=myip | awk -F"ip" '{print $2}' | awk -F'"' '{print $3}'
 
curl -s ifcfg.cn/echo | python -m json.tool

  1. 列表项目

文件数量限制

修改文件

vim /etc/security/limits.conf

添加如下内容到此文件的最后:

* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535

查看是否修改成功

// 重启服务器之后,使用命令
ulimit -n

查找大文件

find . -type f -size +800M

jar包中获取资源

在本地获取路径和jar包中获取路径的方式不同
反例:使用getContextClassLoader().getResource() ,获取路径的时候, 会出现 jar包带"!"的情况 ,导致获取不到文件
正确方式: 使用 new ClassPathResource("static/" + CONFIRM_BOOK);

修改时区

System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')

由于服务器运营商已经封杀了25端口,那么一种方法是:通过465发送邮件到其他邮件服务商

安装邮箱配置

yum install mailx -y

mailx配置

vi /etc/mail.rc
# wkj config
set smtp="smtps://smtp.exmail.qq.com:465"
set from=发送的邮箱(与smtp-auth-user必须一致)
set smtp-auth=login
set smtp-auth-user=发送的邮箱(与from必须一致)
set smtp-auth-password=授权密码
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb

测试发送

echo 内容 | mailx -v -s 主题  -a 附件 接收邮箱