java
AdleyTales
这个作者很懒,什么都没留下…
展开
-
jdk设置编码格式utf-8
经查,是因为在windows中安装的jdk默认编码格式是GBK,需要修改为utf-8.在系统中添加系统变量设置环境变量变量名:JAVA_TOOL_OPTIONS变量值:-Dfile.encoding=UTF-8原创 2021-10-03 21:19:20 · 2387 阅读 · 0 评论 -
idea代码注释不对齐的设置
代码样式 --> Java --> 代码生成 --> 注释的代码 两个对勾去掉原创 2021-09-26 10:46:29 · 1323 阅读 · 1 评论 -
java命令行打包可执行的jar
class Abc{ public static void main(String[] args){ System.out.println("Hi java 16, Abc ..."); }}这是因为之前在打包的时候没有包含清单文件,因此程序不知道主类下面为之前的程序添加清单,首先在当前目录下新建一个文件manf,内容为 Main-Class: Abc上面只是简单的一个类进行打包,如果一个类引用了另外一个类,会怎么样https://blog.csdn.net/whiten原创 2021-03-23 10:03:52 · 189 阅读 · 0 评论 -
springboot 去除非必要的字段给前端
原创 2021-02-18 18:14:52 · 1167 阅读 · 0 评论 -
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?><Configuration> <Properties> <!-- 定义日志格式 --> <Property name="log.pattern">%d{YYYY-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - 【%L】: %msg %n</Property>原创 2021-02-14 10:44:05 · 75 阅读 · 0 评论 -
druid 连接池操作mysql
url=jdbc:mysql://127.0.0.1/test?serverTimezone=UTC#这个可以缺省的,会根据url自动识别driverClassName=com.mysql.cj.jdbc.Driverusername=rootpassword=root##初始连接数,默认0initialSize=10#最大连接数,默认8maxActive=30#最小闲置数minIdle=10#获取连接的最大等待时间,单位毫秒maxWait=2000#缓存PreparedStat原创 2021-02-13 19:42:54 · 262 阅读 · 0 评论 -
idea导出可执行的jar包
https://www.cnblogs.com/ffaiss/p/10908483.html原创 2021-02-08 17:05:57 · 122 阅读 · 0 评论 -
mysql 的官方jar包下载地址
https://downloads.mysql.com/archives/c-j/原创 2021-02-08 15:50:50 · 615 阅读 · 0 评论 -
java读取properties
package hello;import java.io.IOException;import java.util.Properties;public class Main { public static void main(String[] args) throws IOException { // setting.properties Properties props = new Properties(); props.load(Main.class.getResourceA原创 2020-12-12 15:00:37 · 72 阅读 · 0 评论 -
JDBC maven 操作mysql
pom.xml<?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原创 2020-11-13 22:00:10 · 349 阅读 · 0 评论 -
springboot jpa 操作mysql
1. 创建springboot项目2. 编写application.yml配置文件server: port: 8080 servlet: context-path: /spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC username: root passwo原创 2020-09-23 16:07:23 · 298 阅读 · 0 评论 -
springboot 操作mongo
1. 创建springboot项目2. 编写application.yml配置文件server: port: 8080spring: redis: database: 2 host: 127.0.0.1 port: 6379 password: '' jedis: pool: # 连接池最大连接数(使用负值表示没有限制) max-active: 20 max-wait: -1原创 2020-09-22 19:56:42 · 417 阅读 · 0 评论 -
springboot 操作redis
1. 创建springboot项目2. 编辑配置 application.yml 文件server: port: 8080spring: redis: database: 2 host: 127.0.0.1 port: 6379 password: '' jedis: pool: # 连接池最大连接数(使用负值表示没有限制) max-active: 20 max-wait: -1原创 2020-09-22 13:53:06 · 224 阅读 · 0 评论 -
spring data redis 配置redis序列化
默认的存redis list hash数据结构会乱码,需要重新设定序列化配置;redisConfigpackage com.adley.studyspringdata.config;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Bean;import org.springframework.context.annotatio原创 2020-09-18 19:37:30 · 521 阅读 · 0 评论 -
mybatis 中设置插入数据时,返回自动生成的id
正常增删改的返回值只是int类型代表影响行数,或bool类型,表示成功或失败 <insert id="addUser" useGeneratedKeys="true" keyProperty="uid"> insert into users values(null, #{uname}, #{uage}) </insert> User user = new User(null, "test", 13); mapper.addUser(user);原创 2020-08-08 22:26:15 · 799 阅读 · 0 评论 -
Intellij IDEA 自动清除无效 import 和 清除无效 import 的快捷键 ctrl+alt+o
ctrl+alt+o自动清除的配置方法可以settings --> Editor --> General --> Auto Import --> java 下,勾选 optimize imports on the fly,在当前项目下会自动清除无效的import,而且这个是随时自动清除的!原创 2020-07-28 22:27:16 · 2067 阅读 · 0 评论