文章分类 - java
1
摘要:添加代码: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <gro
阅读全文
摘要:public class Test { public static void main(String[] args) { // 循环 for (int j = 0; j < 10; j++) { Integer i = (int)(Math.random()*20+1); //生成(0-20】随机数
阅读全文
摘要:适用于表单字段比较少: <form id="form-change-avatar" class="form-horizontal" role="form"> <div class="form-group"> <label class="col-md-2 control-label">选择头像:</l
阅读全文
摘要:1.SpringBoot中默认MultipartResolver的最大文件大小值为1M。如果上传的文件的大小超过1M,会抛FileSizeLimitExceededException异常。 2.如果需要调整上传的限制值,直接在启动类中添加getMultipartConfigElement()方法,并
阅读全文
摘要:idea有检测功能,接口是不能够直接创建bean的 在idea中进行设置:file->setting->inspections->spring->spring code ->code ->Autowired for bean class,将error级别改为warning级别。 修改后: /** *
阅读全文
摘要:在pom.xml中加入: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
阅读全文
摘要:参考文档:https://www.cnblogs.com/iceb/p/9209796.html 默认springboot使用的日志框架是:SLF4J+Logback。 logback.xml <?xml version="1.0" encoding="UTF-8"?> <configuration
阅读全文
摘要:参考链接:https://www.cnblogs.com/hito/p/11738315.html 需要查看三处设置: 第一处:file -> setting -> build、excution,Deployment -> Compiler -> Java Compiler 第二处: file ->
阅读全文
摘要:访问修饰符 类 同包 子类 其他包 Public √ √ √ √ protected √ √ √ × default √ √ × × privated √ × × × public可以修饰任何类而且类名要与文件名相同,protected不可以修饰类, protected修饰的类在本类、同包、子类(包
阅读全文
摘要:结论:hashcode相等,equals可能相等,也可能不相等, hashcode()不等,一定能推出equals()也不等, equals相等,hashcode肯定相等, equals()不相等的两个对象,却并不能证明他们的hashcode()不相等。 首先,不重写equals方法。 public
阅读全文
摘要:Java中有八种基本数据类型 char >2字节 float >4字节 double >8字节 boolen >1字节 byte >1字节 short >2字节 int >4字节 long >8字节 对位(bit)和字节(byte)的解析:1、bit -->位:位是计算机中存储数据的最小单位,指二进
阅读全文
摘要:public class Test2 { public static void main(String[] args) { // 左移动1位 // 0000 0111 7 // 0000 1110 14 int num = 7; num = num << 1; System.out.println(
阅读全文
摘要:pom坐标: <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> 实体类: public class Student
阅读全文
摘要:function saveCollect1(){ var getDirectoryAjaxUrl=basePath+'/report/fileSystem/saveCollection1'; var paramData={ fileName:'save', path:"http://baidu.co
阅读全文
摘要:上代码: public class Test { public static void main(String[] args) { int i = 1; int j = 1; int x = i++; int y = ++j; // 对于int x = i++; i先赋值给x,也就是x=1。然后i自
阅读全文
摘要:CPU缓存模型: Java内存模型(简称JMM),是一种规范。JMM决定一个线程对共享变量的写入何时对另一个线程可见。从抽象的角度来看,JMM定义了线程和主内存之间的抽象关系:线程之间的共享变量存储在主内存(main memory)中,每个线程都有一个私有的本地内存(local memory),本地
阅读全文
摘要:接口: public interface CommonService { public int sell(int count); } 实现类(目标类): public class Real implements CommonService{ @Override public int sell(int
阅读全文
摘要:并发编程三大特征:可见性、原子性、有序性 volatile保证可见性与有序性,但是不保证原子性,保证原子性需要借助synchronized这样的锁机制。 不加volatile修饰: public class Test { public static boolean initFlag=false; p
阅读全文
摘要:public class CommonUtils { public static void main(String[] args) { createDir();// 创建文件夹 createFile();// 创建文件 } public static String path() { // Date
阅读全文
摘要:public class CommonUtils1 { public static void main(String[] args) { createDir();// 创建文件夹 createFile();// 创建文件 } public static String path() { //Date
阅读全文
1