mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge branch '1.5.x'
This commit is contained in:
commit
cfdc75d384
@ -95,9 +95,9 @@ public class InMemoryAuditEventRepository implements AuditEventRepository {
|
||||
|
||||
private boolean isMatch(String principal, Date after, String type, AuditEvent event) {
|
||||
boolean match = true;
|
||||
match &= (principal == null || event.getPrincipal().equals(principal));
|
||||
match &= (after == null || event.getTimestamp().compareTo(after) >= 0);
|
||||
match &= (type == null || event.getType().equals(type));
|
||||
match = match && (principal == null || event.getPrincipal().equals(principal));
|
||||
match = match && (after == null || event.getTimestamp().compareTo(after) >= 0);
|
||||
match = match && (type == null || event.getType().equals(type));
|
||||
return match;
|
||||
}
|
||||
|
||||
|
@ -126,9 +126,9 @@ public class Metric<T extends Number> {
|
||||
if (obj instanceof Metric) {
|
||||
Metric<?> other = (Metric<?>) obj;
|
||||
boolean rtn = true;
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp);
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.value, other.value);
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp);
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.value, other.value);
|
||||
return rtn;
|
||||
}
|
||||
return super.equals(obj);
|
||||
|
@ -280,8 +280,8 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
if (getClass() == obj.getClass()) {
|
||||
ToStringFriendlyFeatureAwareVersion other = (ToStringFriendlyFeatureAwareVersion) obj;
|
||||
boolean equals = true;
|
||||
equals &= this.features.equals(other.features);
|
||||
equals &= this.version.equals(other.version);
|
||||
equals = equals && this.features.equals(other.features);
|
||||
equals = equals && this.version.equals(other.version);
|
||||
return equals;
|
||||
}
|
||||
return super.equals(obj);
|
||||
|
@ -125,10 +125,10 @@ public final class Dependency {
|
||||
if (getClass() == obj.getClass()) {
|
||||
Dependency other = (Dependency) obj;
|
||||
boolean result = true;
|
||||
result &= this.groupId.equals(other.groupId);
|
||||
result &= this.artifactId.equals(other.artifactId);
|
||||
result &= this.version.equals(other.version);
|
||||
result &= this.exclusions.equals(other.exclusions);
|
||||
result = result && this.groupId.equals(other.groupId);
|
||||
result = result && this.artifactId.equals(other.artifactId);
|
||||
result = result && this.version.equals(other.version);
|
||||
result = result && this.exclusions.equals(other.exclusions);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
@ -187,8 +187,8 @@ public final class Dependency {
|
||||
if (getClass() == obj.getClass()) {
|
||||
Exclusion other = (Exclusion) obj;
|
||||
boolean result = true;
|
||||
result &= this.groupId.equals(other.groupId);
|
||||
result &= this.artifactId.equals(other.artifactId);
|
||||
result = result && this.groupId.equals(other.groupId);
|
||||
result = result && this.artifactId.equals(other.artifactId);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
|
@ -59,9 +59,9 @@ class FileSnapshot {
|
||||
if (obj instanceof FileSnapshot) {
|
||||
FileSnapshot other = (FileSnapshot) obj;
|
||||
boolean equals = this.file.equals(other.file);
|
||||
equals &= this.exists == other.exists;
|
||||
equals &= this.length == other.length;
|
||||
equals &= this.lastModified == other.lastModified;
|
||||
equals = equals && this.exists == other.exists;
|
||||
equals = equals && this.length == other.length;
|
||||
equals = equals && this.lastModified == other.lastModified;
|
||||
return equals;
|
||||
}
|
||||
return super.equals(obj);
|
||||
|
@ -14,8 +14,8 @@ abstraction is supported by many caching libraries, including:
|
||||
* Generic provider based on `org.springframework.Cache` bean definition(s)
|
||||
|
||||
The sample defines a simple `CountryService` that caches countries by ISO code. When
|
||||
the application starts a client invokes the service with a random code every 500ms. You
|
||||
can look at the `/metrics` endpoint to review the cache statistics if your chosen
|
||||
the application starts a client invokes the service with a random code every 500ms.
|
||||
You can look at the `/metrics` endpoint to review the cache statistics if your chosen
|
||||
caching provider is supported.
|
||||
|
||||
|
||||
@ -25,30 +25,31 @@ The sample uses Spring's cache annotation. If you want to use the JSR-107 annota
|
||||
instead, simply add the `javax.cache:cache-api` dependency to the project. No further
|
||||
configuration is necessary.
|
||||
|
||||
NOTE: You can use the JSR-107 annotations with _any_ cache provider; a JSR-107 compliant
|
||||
cache provider is not necessary.
|
||||
NOTE: You can use the JSR-107 annotations with _any_ cache provider; a JSR-107
|
||||
compliant cache provider is not necessary.
|
||||
|
||||
|
||||
|
||||
== Using a different cache provider
|
||||
Initially, the project does not define any caching library so the abstraction works
|
||||
on simple `ConcurrentHashMap`-based caches. You can try out your favorite caching library
|
||||
as explained below.
|
||||
on simple `ConcurrentHashMap`-based caches. You can try out your favorite caching
|
||||
library as explained below.
|
||||
|
||||
|
||||
|
||||
=== JCache (JSR-107)
|
||||
If you want to configure your cache infrastructure via the standard, you need a compliant
|
||||
implementation and the JSR-107 api. You first need to add `javax.cache:cache-api` to your
|
||||
project. Then you could try the following:
|
||||
If you want to configure your cache infrastructure via the standard, you need a
|
||||
compliant implementation and the JSR-107 api. You first need to add
|
||||
`javax.cache:cache-api` to your project. Then you could try the following:
|
||||
|
||||
* `EhCache 3`: add `org.ehcache:ehcache`
|
||||
* `Hazelcast`: add `com.hazelcast:hazelcast`
|
||||
* `Infinispan`: add `org.infinispan:infinispan-jcache`
|
||||
|
||||
TIP: Certain cache providers do not create a default cache on-the-fly if it does not exist
|
||||
so you might need to update the sample to create the caches on startup or specify the
|
||||
location to the provider-specific file via the `spring.cache.jcache.config` property.
|
||||
TIP: Certain cache providers do not create a default cache on-the-fly if it does not
|
||||
exist so you might need to update the sample to create the caches on startup or
|
||||
specify the location to the provider-specific file via the
|
||||
`spring.cache.jcache.config` property.
|
||||
|
||||
NOTE: Any other JSR-107 compliant provider is also supported but Spring Boot may not
|
||||
offer a dependency management entry for it. You will have to add it with the version
|
||||
@ -58,39 +59,55 @@ of the library that you want to use.
|
||||
|
||||
=== EhCache 2.x
|
||||
Simply add the `net.sf.ehcache:ehcache` dependency to the project. Since there is a
|
||||
default `ehcache.xml` configuration file at the root of the classpath, it is automatically
|
||||
used to configure the underlying `CacheManager`. Note that EhCache 3 uses a different
|
||||
format and doesn't default to `ehcache.xml` anymore. Check
|
||||
http://www.ehcache.org/documentation/3.0/xml.html[the documentation] for more details.
|
||||
default `ehcache.xml` configuration file at the root of the classpath,
|
||||
it is automatically used to configure the underlying `CacheManager`.
|
||||
Note that EhCache 3 uses a different format and doesn't default to `ehcache.xml`
|
||||
anymore. Check http://www.ehcache.org/documentation/3.0/xml.html[the documentation]
|
||||
for more details.
|
||||
|
||||
TIP: Run sample cache application using EhCache with
|
||||
`$mvn spring-boot:run -Pehcache2`.
|
||||
|
||||
|
||||
|
||||
=== Hazelcast
|
||||
Both `com.hazelcast:hazelcast` and `com.hazelcast:hazelcast-spring` should be added to
|
||||
the project to enable support for Hazelcast. Since there is a default `hazelcast.xml`
|
||||
configuration file at the root of the classpath, it is used to automatically configure
|
||||
the underlying `HazelcastInstance`.
|
||||
Both `com.hazelcast:hazelcast` and `com.hazelcast:hazelcast-spring` should be added
|
||||
to the project to enable support for Hazelcast. Since there is a default
|
||||
`hazelcast.xml` configuration file at the root of the classpath, it is used to
|
||||
automatically configure the underlying `HazelcastInstance`.
|
||||
|
||||
TIP: Run sample cache application using Hazelcast with
|
||||
`$mvn spring-boot:run -Phazelcast`.
|
||||
|
||||
|
||||
|
||||
=== Infinispan
|
||||
Add the `org.infinispan:infinispan-spring4-embedded` dependency to enable support for
|
||||
Infinispan. There is no default location that Infinispan uses to look for a config file
|
||||
so if you don't specify anything it will bootstrap on a hardcoded default. You can set
|
||||
the `spring.cache.infinispan.config` property to use the provided `infinispan.xml`
|
||||
configuration instead.
|
||||
Infinispan. There is no default location that Infinispan uses to look for a config
|
||||
file so if you don't specify anything it will bootstrap on a hardcoded default. You
|
||||
can set the `spring.cache.infinispan.config` property to use the provided
|
||||
`infinispan.xml` configuration instead.
|
||||
|
||||
TIP: Run sample cache application using Hazelcast with
|
||||
`$mvn spring-boot:run -Pinfinispan`.
|
||||
|
||||
|
||||
|
||||
=== Couchbase
|
||||
Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that you
|
||||
have setup at least a `spring.couchbase.bootstrap-hosts` property.
|
||||
Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that
|
||||
you have setup at least a `spring.couchbase.bootstrap-hosts` property.
|
||||
|
||||
TIP: Run sample cache application using Hazelcast with
|
||||
`$mvn spring-boot:run -Pcouchbase`.
|
||||
|
||||
|
||||
|
||||
=== Redis
|
||||
Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by default,
|
||||
a redis instance with the default settings is expected on your local box).
|
||||
Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by
|
||||
default, a redis instance with the default settings is expected on your local box).
|
||||
|
||||
TIP: Run sample cache application using Hazelcast with
|
||||
`$mvn spring-boot:run -Predis`.
|
||||
|
||||
|
||||
|
||||
@ -98,3 +115,6 @@ a redis instance with the default settings is expected on your local box).
|
||||
Simply add the `com.github.ben-manes.caffeine:caffeine` dependency to enable support
|
||||
for Caffeine. You can customize how caches are created in different ways, see
|
||||
`application.properties` for an example and the documentation for more details.
|
||||
|
||||
TIP: Run sample cache application using Hazelcast with
|
||||
`$mvn spring-boot:run -Pcaffeine`.
|
@ -33,71 +33,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSR-107 API (uncomment to try the JCache support) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>javax.cache</groupId>
|
||||
<artifactId>cache-api</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- Additional cache providers (uncomment to try them) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.hazelcast</groupId>
|
||||
<artifactId>hazelcast</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hazelcast</groupId>
|
||||
<artifactId>hazelcast-spring</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-spring4-embedded</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-jcache</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.couchbase.client</groupId>
|
||||
<artifactId>java-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couchbase.client</groupId>
|
||||
<artifactId>couchbase-spring-cache</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -113,4 +48,104 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jcache</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.cache</groupId>
|
||||
<artifactId>cache-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>caffeine</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>couchbase</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.couchbase.client</groupId>
|
||||
<artifactId>java-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couchbase.client</groupId>
|
||||
<artifactId>couchbase-spring-cache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>ehcache2</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>ehcache</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.cache</groupId>
|
||||
<artifactId>cache-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>hazelcast</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.hazelcast</groupId>
|
||||
<artifactId>hazelcast</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hazelcast</groupId>
|
||||
<artifactId>hazelcast-spring</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>infinispan</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-spring4-embedded</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-jcache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>redis</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>guava</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
@ -142,17 +142,17 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
|
||||
}
|
||||
AnnotationCustomizableTypeExcludeFilter other = (AnnotationCustomizableTypeExcludeFilter) obj;
|
||||
boolean result = true;
|
||||
result &= hasAnnotation() == other.hasAnnotation();
|
||||
result = result && hasAnnotation() == other.hasAnnotation();
|
||||
for (FilterType filterType : FilterType.values()) {
|
||||
result &= ObjectUtils.nullSafeEquals(getFilters(filterType),
|
||||
other.getFilters(filterType));
|
||||
}
|
||||
result &= isUseDefaultFilters() == other.isUseDefaultFilters();
|
||||
result &= ObjectUtils.nullSafeEquals(getDefaultIncludes(),
|
||||
result = result && isUseDefaultFilters() == other.isUseDefaultFilters();
|
||||
result = result && ObjectUtils.nullSafeEquals(getDefaultIncludes(),
|
||||
other.getDefaultIncludes());
|
||||
result &= ObjectUtils.nullSafeEquals(getComponentIncludes(),
|
||||
result = result && ObjectUtils.nullSafeEquals(getComponentIncludes(),
|
||||
other.getComponentIncludes());
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,11 +97,11 @@ abstract class Definition {
|
||||
}
|
||||
Definition other = (Definition) obj;
|
||||
boolean result = true;
|
||||
result &= ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
result &= ObjectUtils.nullSafeEquals(this.reset, other.reset);
|
||||
result &= ObjectUtils.nullSafeEquals(this.proxyTargetAware,
|
||||
result = result && ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.reset, other.reset);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.proxyTargetAware,
|
||||
other.proxyTargetAware);
|
||||
result &= ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -119,10 +119,10 @@ class MockDefinition extends Definition {
|
||||
}
|
||||
MockDefinition other = (MockDefinition) obj;
|
||||
boolean result = super.equals(obj);
|
||||
result &= ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock);
|
||||
result &= ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces);
|
||||
result &= ObjectUtils.nullSafeEquals(this.answer, other.answer);
|
||||
result &= this.serializable == other.serializable;
|
||||
result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer);
|
||||
result = result && this.serializable == other.serializable;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class SpyDefinition extends Definition {
|
||||
}
|
||||
SpyDefinition other = (SpyDefinition) obj;
|
||||
boolean result = super.equals(obj);
|
||||
result &= ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy);
|
||||
result = result && ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -99,10 +99,10 @@ public final class LoggerConfiguration {
|
||||
if (obj instanceof LoggerConfiguration) {
|
||||
LoggerConfiguration other = (LoggerConfiguration) obj;
|
||||
boolean rtn = true;
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.configuredLevel,
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name);
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.configuredLevel,
|
||||
other.configuredLevel);
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel);
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel);
|
||||
return rtn;
|
||||
}
|
||||
return super.equals(obj);
|
||||
|
@ -125,10 +125,10 @@ public class ErrorPage {
|
||||
if (obj instanceof ErrorPage) {
|
||||
ErrorPage other = (ErrorPage) obj;
|
||||
boolean rtn = true;
|
||||
rtn &= ObjectUtils.nullSafeEquals(getExceptionName(),
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(),
|
||||
other.getExceptionName());
|
||||
rtn &= ObjectUtils.nullSafeEquals(this.path, other.path);
|
||||
rtn &= this.status == other.status;
|
||||
rtn = rtn && ObjectUtils.nullSafeEquals(this.path, other.path);
|
||||
rtn = rtn && this.status == other.status;
|
||||
return rtn;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user