1. yml文件中配置数据库
这样写是对的:
spring:
datasource:
username: root
password: 123456
url: jdbc:mysql://localhost:3306/boot?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
driverClassName: com.mysql.cj.jdbc.Driver
这样写报错:(IDEA提示的代码就是这样!)
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/boot?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT
user: root
password: 123456
2. Windows端口被占用怎么办
3. SprintBoot配置文件优先级
4. bean的加载方式
5. Java中的&与&&、|与||、>>与>>>的区别
&:按位与运算符。0&0=0, 0&1=0,1&0=0,1&1=1 。a&b,a为false时还会继续运算b
&&:逻辑与运算符。a&&b ,当a为false时不再运算b
|:按位或运算符。0|0=0, 0|1=1,1|0=1, 1|1=1。
||:逻辑或运算符。
>>:有符号右移,正数高位补0,负数高位补1
>>>: 无符号右移,正负数都在高位补0
6. stream().map().collect()
List<E> list= getList();
List<E> newList=new ArrayList<E>();
for(int i=0;i<list.size();i++){
newList.add(list.get(i).getId());
}
//===============================【等价于】===================================
List<E> newList= list.stream().map(E::getId).collect(Collectors.toList());
7. JVM相关参数
8. 阻塞队列BlockingQueue
解读 java 并发队列 BlockingQueue_Javadoop