我知道'=='不适用于[-128,127]范围之外的值,因为在此范围内有一个由Integer对象维护的缓存,如果value在该范围内,则返回相同的引用.但是为什么'>','<','> =','<='即使在范围之外也会给出正确答案?
Integer a=150;
Integer b=150;
System.out.println(a==b); //returns false
Integer a=150;
Integer b=150;
System.out.println(a>=b); // returns true
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
既然所有传递依赖项都已经存在于 spring-boot-starter-web 中,为什么我们需要为 log42j 添加额外的依赖项?从我可以在互联网上阅读的任何教程中,每个人都提到添加依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
他们还提到spring-boot-starter-logging排除spring-boot-starter-web。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但为什么我们需要这样做呢?我看到 中的所有依赖项spring-boot-starter-log4j2都已存在于 中spring-boot-starter-logging。