mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ea8ba1b96 | |||
| ae8b7973b4 | |||
| a7f430bda8 | |||
| 5a781eeb54 | |||
| a879d18c9c | |||
| ce49068ff9 | |||
| 62a0ab3667 | |||
| 92a231cf91 | |||
| 50dff77d01 | |||
| 0f479293b1 | |||
| 5f5d383eeb | |||
| 529481c44c | |||
| 35d379f9d3 | |||
| c871758a51 | |||
| 0d2bfc926f | |||
| 4e97776969 | |||
| d42f950a36 | |||
| 4eabe29b9a | |||
| cd10171f98 | |||
| 597c687da8 | |||
| 081d70123e | |||
| d9c2ccb4b3 | |||
| c503f356c7 | |||
| 7f9933fdb7 | |||
| a425512025 | |||
| 298c9a6f1b | |||
| 8dcb2a75fa | |||
| 111a9902ac | |||
| 0389fcca7e | |||
| bb3ada4a67 | |||
| 6a68bd58f9 | |||
| b1414bf15b | |||
| f91943977c | |||
| 4c0ece944a | |||
| 2c75eb8745 | |||
| 711820ec70 | |||
| 69d87f16ee | |||
| 38f94799f4 | |||
| 4264d0becd | |||
| 7e7d6b9c3a | |||
| dfc06eda7a | |||
| f0aa6ebed6 | |||
| 6806aaf162 | |||
| ccec75c98d | |||
| 22029b4487 | |||
| d6b60046ce | |||
| 6685e78c36 | |||
| 8685b2f5bf | |||
| 4af225405c | |||
| 51e594ae81 | |||
| c2554b2b27 | |||
| 86a762b5ee | |||
| 211241befe | |||
| 0caa2ac696 | |||
| 4eb8a5c082 | |||
| d080b64907 | |||
| 5ab55dfb64 | |||
| 04209def46 | |||
| 3a61930bd0 | |||
| 456c7889a3 | |||
| 982d8ea84a | |||
| 67eb2bbf19 | |||
| a6596e2446 | |||
| 812b089f1d | |||
| 2172b99fee | |||
| b6144e5682 | |||
| 6e6f8637d1 | |||
| 00f7f5ff0a | |||
| 3d4a778b73 | |||
| 446c1add4f | |||
| aef4b0ec5a | |||
| 675e0b94c1 | |||
| b8b54ee524 | |||
| 97ea8a6789 | |||
| 95a400abfb | |||
| 4383a673bb | |||
| f7b94fc3e8 | |||
| 93760d1211 | |||
| 421b5cb311 | |||
| 1cc36e5be9 | |||
| f7c32d3a0b | |||
| 9c0a2eeeb2 | |||
| 7fa9f1c9cf | |||
| 1e03b30d33 | |||
| 7df149c8b8 | |||
| e50131d454 | |||
| cdd4e8cd7f | |||
| 02b7ddbc70 | |||
| 8e5c4903d4 | |||
| bd3499671c | |||
| 2e4d7e4ef9 | |||
| c6be3b33c9 | |||
| c112bb0ae1 | |||
| 165fba868c | |||
| 2ca64ad88a | |||
| ea27206a32 | |||
| c48c5e7691 | |||
| bc15f839cd | |||
| 46db372951 | |||
| 91258271e4 | |||
| e76fbcb290 | |||
| 82ca27e46f | |||
| bca104798b | |||
| b30eb6837c | |||
| ac06d1dfa9 | |||
| cfb39acc97 | |||
| 222dbf8377 | |||
| 10838a636f | |||
| 3c3ae32f07 | |||
| a3e46a2db7 | |||
| de1b938e2e | |||
| d72aeac319 | |||
| 5247eeba84 | |||
| ae70e3c81c | |||
| c942c8d2cf | |||
| 1201af20e4 | |||
| d1df4d3739 | |||
| 1ef8800c6c | |||
| 4d7e4e0c58 | |||
| c7067269b3 | |||
| 3af6a22b9f | |||
| 31a9694fc8 | |||
| 92b8e99cbc | |||
| 3b68e97710 | |||
| 6f494ef438 | |||
| 19704805fd | |||
| 31c6965c7f | |||
| 5b1a84e395 | |||
| 6985fa8057 | |||
| 03f0c57704 | |||
| d274e893a6 | |||
| aa8b06b622 | |||
| 323dbb912e | |||
| 63d7e81a48 | |||
| 07960d4918 | |||
| 07cfcbc3a9 | |||
| 2af27d899f | |||
| 0621a8eff1 | |||
| 7ac646bc96 | |||
| 2c3243c93c | |||
| 2bf5f7a6b3 | |||
| bf39492c34 | |||
| 007bdede46 | |||
| 22cc6c5918 | |||
| 461ba53b39 | |||
| d1d6eb095e | |||
| f732fab820 | |||
| fda3f8201a | |||
| e608b36713 | |||
| 59180e76a7 | |||
| c5987d7c37 | |||
| 5650e20edd | |||
| 2885177f5b | |||
| 058ce36402 | |||
| 2afe560e41 | |||
| b95362a3fd | |||
| 9ea45697ac | |||
| fe2b8580a0 | |||
| 622fc3edf7 | |||
| 9868c28c73 | |||
| a970516080 | |||
| 0c9def89de | |||
| 8892a05868 | |||
| d6768ccc18 | |||
| faf20b7a5a | |||
| 661996471e | |||
| 5639ff0939 | |||
| e98b602d4f | |||
| edfe5d2f18 | |||
| 26df4580b3 | |||
| 57208bf47a | |||
| 8b34558284 | |||
| dbe8f200a9 | |||
| ea4d9a20ac | |||
| e19e9757d4 | |||
| 2473e956ff | |||
| 854307d8d8 | |||
| 3401359bdf | |||
| f1c00dd8a6 | |||
| bdf91ac435 | |||
| 181023c0c3 | |||
| fb1fa073a6 | |||
| e9806a96dc | |||
| 9b93508374 | |||
| 8b4750e705 | |||
| 2e033339d1 |
@@ -1,6 +1,9 @@
|
||||
name: "Validate Gradle Wrapper"
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
|
||||
@@ -21,6 +21,7 @@ classes/
|
||||
/build
|
||||
buildSrc/build
|
||||
/spring-*/build
|
||||
/spring-core/graalvm/build
|
||||
/spring-core/kotlin-coroutines/build
|
||||
/framework-bom/build
|
||||
/integration-tests/build
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Enable auto-env through the sdkman_auto_env config
|
||||
# Add key=value pairs of SDKs to use below
|
||||
java=8.0.333-librca
|
||||
java=8.0.345-librca
|
||||
|
||||
@@ -14,16 +14,16 @@ For access to artifacts or a distribution zip, see the [Spring Framework Artifac
|
||||
|
||||
## Documentation
|
||||
|
||||
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/) and [source](src/docs/asciidoc)), Github [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
|
||||
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/) and [source](src/docs/asciidoc)), GitHub [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
|
||||
[API reference](https://docs.spring.io/spring-framework/docs/current/javadoc-api/). There are also [guides and tutorials](https://spring.io/guides) across Spring projects.
|
||||
|
||||
## Micro-Benchmarks
|
||||
|
||||
See the [Micro-Benchmarks](https://github.com/spring-projects/spring-framework/wiki/Micro-Benchmarks) Wiki page.
|
||||
See the [Micro-Benchmarks](https://github.com/spring-projects/spring-framework/wiki/Micro-Benchmarks) wiki page.
|
||||
|
||||
## Build from Source
|
||||
|
||||
See the [Build from Source](https://github.com/spring-projects/spring-framework/wiki/Build-from-Source) Wiki page and the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
||||
See the [Build from Source](https://github.com/spring-projects/spring-framework/wiki/Build-from-Source) wiki page and the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
||||
|
||||
## Continuous Integration Builds
|
||||
|
||||
|
||||
+24
-22
@@ -28,18 +28,18 @@ configure(allprojects) { project ->
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom "com.fasterxml.jackson:jackson-bom:2.12.7"
|
||||
mavenBom "io.netty:netty-bom:4.1.77.Final"
|
||||
mavenBom "io.projectreactor:reactor-bom:2020.0.20"
|
||||
mavenBom "io.netty:netty-bom:4.1.82.Final"
|
||||
mavenBom "io.projectreactor:reactor-bom:2020.0.23"
|
||||
mavenBom "io.r2dbc:r2dbc-bom:Arabba-SR13"
|
||||
mavenBom "io.rsocket:rsocket-bom:1.1.2"
|
||||
mavenBom "org.eclipse.jetty:jetty-bom:9.4.46.v20220331"
|
||||
mavenBom "io.rsocket:rsocket-bom:1.1.3"
|
||||
mavenBom "org.eclipse.jetty:jetty-bom:9.4.48.v20220622"
|
||||
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.5.32"
|
||||
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.5.2"
|
||||
mavenBom "org.jetbrains.kotlinx:kotlinx-serialization-bom:1.2.2"
|
||||
mavenBom "org.junit:junit-bom:5.8.2"
|
||||
}
|
||||
dependencies {
|
||||
dependencySet(group: 'org.apache.logging.log4j', version: '2.17.2') {
|
||||
dependencySet(group: 'org.apache.logging.log4j', version: '2.18.0') {
|
||||
entry 'log4j-api'
|
||||
entry 'log4j-core'
|
||||
entry 'log4j-jul'
|
||||
@@ -67,8 +67,8 @@ configure(allprojects) { project ->
|
||||
dependency "io.reactivex:rxjava:1.3.8"
|
||||
dependency "io.reactivex:rxjava-reactive-streams:1.2.1"
|
||||
dependency "io.reactivex.rxjava2:rxjava:2.2.21"
|
||||
dependency "io.reactivex.rxjava3:rxjava:3.1.4"
|
||||
dependency "io.smallrye.reactive:mutiny:1.4.0"
|
||||
dependency "io.reactivex.rxjava3:rxjava:3.1.5"
|
||||
dependency "io.smallrye.reactive:mutiny:1.7.0"
|
||||
dependency "io.projectreactor.tools:blockhound:1.0.6.RELEASE"
|
||||
|
||||
dependency "com.caucho:hessian:4.0.63"
|
||||
@@ -79,7 +79,7 @@ configure(allprojects) { project ->
|
||||
dependency "com.google.code.gson:gson:2.8.9"
|
||||
dependency "com.google.protobuf:protobuf-java-util:3.19.3"
|
||||
dependency "com.googlecode.protobuf-java-format:protobuf-java-format:1.4"
|
||||
dependency("com.thoughtworks.xstream:xstream:1.4.18") {
|
||||
dependency("com.thoughtworks.xstream:xstream:1.4.19") {
|
||||
exclude group: "xpp3", name: "xpp3_min"
|
||||
exclude group: "xmlpull", name: "xmlpull"
|
||||
}
|
||||
@@ -94,9 +94,9 @@ configure(allprojects) { project ->
|
||||
dependency "org.ogce:xpp3:1.1.6"
|
||||
dependency "org.yaml:snakeyaml:1.30"
|
||||
|
||||
dependency "com.h2database:h2:2.1.212"
|
||||
dependency "com.h2database:h2:2.1.214"
|
||||
dependency "com.github.ben-manes.caffeine:caffeine:2.9.3"
|
||||
dependency "com.github.librepdf:openpdf:1.3.28"
|
||||
dependency "com.github.librepdf:openpdf:1.3.29"
|
||||
dependency "com.rometools:rome:1.18.0"
|
||||
dependency "commons-io:commons-io:2.5"
|
||||
dependency "io.vavr:vavr:0.10.4"
|
||||
@@ -124,22 +124,22 @@ configure(allprojects) { project ->
|
||||
dependency "org.ehcache:jcache:1.0.1"
|
||||
dependency "org.ehcache:ehcache:3.4.0"
|
||||
dependency "org.hibernate:hibernate-core:5.4.33.Final"
|
||||
dependency "org.hibernate:hibernate-validator:6.2.3.Final"
|
||||
dependency "org.hibernate:hibernate-validator:6.2.5.Final"
|
||||
dependency "org.webjars:webjars-locator-core:0.48"
|
||||
dependency "org.webjars:underscorejs:1.8.3"
|
||||
|
||||
dependencySet(group: 'org.apache.tomcat', version: '9.0.64') {
|
||||
dependencySet(group: 'org.apache.tomcat', version: '9.0.65') {
|
||||
entry 'tomcat-util'
|
||||
entry('tomcat-websocket') {
|
||||
exclude group: "org.apache.tomcat", name: "tomcat-servlet-api"
|
||||
exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
|
||||
}
|
||||
}
|
||||
dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.64') {
|
||||
dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.65') {
|
||||
entry 'tomcat-embed-core'
|
||||
entry 'tomcat-embed-websocket'
|
||||
}
|
||||
dependencySet(group: 'io.undertow', version: '2.2.17.Final') {
|
||||
dependencySet(group: 'io.undertow', version: '2.2.19.Final') {
|
||||
entry 'undertow-core'
|
||||
entry('undertow-servlet') {
|
||||
exclude group: "org.jboss.spec.javax.servlet", name: "jboss-servlet-api_4.0_spec"
|
||||
@@ -150,7 +150,7 @@ configure(allprojects) { project ->
|
||||
}
|
||||
}
|
||||
|
||||
dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.11"
|
||||
dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.12"
|
||||
dependency 'org.apache.httpcomponents.client5:httpclient5:5.1.3'
|
||||
dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.3'
|
||||
dependency("org.apache.httpcomponents:httpclient:4.5.13") {
|
||||
@@ -188,8 +188,8 @@ configure(allprojects) { project ->
|
||||
exclude group: "junit", name: "junit"
|
||||
}
|
||||
dependency "org.testng:testng:7.4.0"
|
||||
dependency "org.junit.support:testng-engine:1.0.1"
|
||||
dependency "org.hamcrest:hamcrest:2.1"
|
||||
dependency "org.junit.support:testng-engine:1.0.4"
|
||||
dependency "org.hamcrest:hamcrest:2.2"
|
||||
dependency "org.awaitility:awaitility:3.1.6"
|
||||
dependency "org.assertj:assertj-core:3.23.0"
|
||||
dependencySet(group: 'org.xmlunit', version: '2.9.0') {
|
||||
@@ -206,10 +206,10 @@ configure(allprojects) { project ->
|
||||
}
|
||||
dependency "io.mockk:mockk:1.12.1"
|
||||
|
||||
dependency("net.sourceforge.htmlunit:htmlunit:2.62.0") {
|
||||
dependency("net.sourceforge.htmlunit:htmlunit:2.64.0") {
|
||||
exclude group: "commons-logging", name: "commons-logging"
|
||||
}
|
||||
dependency("org.seleniumhq.selenium:htmlunit-driver:2.62.0") {
|
||||
dependency("org.seleniumhq.selenium:htmlunit-driver:2.64.0") {
|
||||
exclude group: "commons-logging", name: "commons-logging"
|
||||
}
|
||||
dependency("org.seleniumhq.selenium:selenium-java:3.141.59") {
|
||||
@@ -217,8 +217,8 @@ configure(allprojects) { project ->
|
||||
exclude group: "io.netty", name: "netty"
|
||||
}
|
||||
dependency "org.skyscreamer:jsonassert:1.5.0"
|
||||
dependency "com.jayway.jsonpath:json-path:2.6.0"
|
||||
dependency "org.bouncycastle:bcpkix-jdk15on:1.66"
|
||||
dependency "com.jayway.jsonpath:json-path:2.7.0"
|
||||
dependency "org.bouncycastle:bcpkix-jdk18on:1.71"
|
||||
|
||||
dependencySet(group: 'org.apache.tiles', version: '3.0.8') {
|
||||
entry 'tiles-api'
|
||||
@@ -340,7 +340,7 @@ configure([rootProject] + javaProjects) { project ->
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.3"
|
||||
toolVersion = "10.3.3"
|
||||
configDirectory.set(rootProject.file("src/checkstyle"))
|
||||
}
|
||||
|
||||
@@ -413,6 +413,8 @@ configure(rootProject) {
|
||||
|
||||
nohttp {
|
||||
source.exclude "**/test-output/**"
|
||||
source.exclude "spring-core/graalvm/build/**" // only available on `main`
|
||||
source.exclude "spring-core-test/build/**" // only available on `main`
|
||||
allowlistFile = project.file("src/nohttp/allowlist.lines")
|
||||
def rootPath = file(rootDir).toPath()
|
||||
def projectDirs = allprojects.collect { it.projectDir } + "${rootDir}/buildSrc"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM ubuntu:focal-20220531
|
||||
FROM ubuntu:focal-20220826
|
||||
|
||||
ADD setup.sh /setup.sh
|
||||
ADD get-jdk-url.sh /get-jdk-url.sh
|
||||
|
||||
@@ -3,16 +3,16 @@ set -e
|
||||
|
||||
case "$1" in
|
||||
java8)
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/8u333+2/bellsoft-jdk8u333+2-linux-amd64.tar.gz"
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/8u345+1/bellsoft-jdk8u345+1-linux-amd64.tar.gz"
|
||||
;;
|
||||
java11)
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/11.0.15.1+2/bellsoft-jdk11.0.15.1+2-linux-amd64.tar.gz"
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/11.0.16+8/bellsoft-jdk11.0.16+8-linux-amd64.tar.gz"
|
||||
;;
|
||||
java17)
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/17.0.3.1+2/bellsoft-jdk17.0.3.1+2-linux-amd64.tar.gz"
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/17.0.4+8/bellsoft-jdk17.0.4+8-linux-amd64.tar.gz"
|
||||
;;
|
||||
java18)
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/18.0.1.1+2/bellsoft-jdk18.0.1.1+2-linux-amd64.tar.gz"
|
||||
echo "https://github.com/bell-sw/Liberica/releases/download/18.0.2+10/bellsoft-jdk18.0.2+10-linux-amd64.tar.gz"
|
||||
;;
|
||||
*)
|
||||
echo $"Unknown java version"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
version=5.3.21-SNAPSHOT
|
||||
version=5.3.23
|
||||
org.gradle.jvmargs=-Xmx2048m
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ asciidoctorPdf {
|
||||
task docsZip(type: Zip, dependsOn: ['api', 'asciidoctor', 'asciidoctorPdf', 'dokkaHtmlMultiModule']) {
|
||||
group = "Distribution"
|
||||
description = "Builds -${archiveClassifier} archive containing api and reference " +
|
||||
"for deployment at https://docs.spring.io/spring-framework/docs."
|
||||
"for deployment at https://docs.spring.io/spring-framework/docs/."
|
||||
|
||||
archiveBaseName.set("spring-framework")
|
||||
archiveClassifier.set("docs")
|
||||
|
||||
@@ -72,6 +72,7 @@ eclipse.classpath.file.whenMerged {
|
||||
// Include project specific settings
|
||||
task eclipseSettings(type: Copy) {
|
||||
from rootProject.files(
|
||||
'src/eclipse/org.eclipse.core.resources.prefs',
|
||||
'src/eclipse/org.eclipse.jdt.core.prefs',
|
||||
'src/eclipse/org.eclipse.jdt.ui.prefs')
|
||||
into project.file('.settings/')
|
||||
@@ -79,6 +80,7 @@ task eclipseSettings(type: Copy) {
|
||||
}
|
||||
|
||||
task cleanEclipseSettings(type: Delete) {
|
||||
delete project.file('.settings/org.eclipse.core.resources.prefs')
|
||||
delete project.file('.settings/org.eclipse.jdt.core.prefs')
|
||||
delete project.file('.settings/org.eclipse.jdt.ui.prefs')
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,6 +31,6 @@ You'll notice these files are already intentionally in .gitignore. The same poli
|
||||
|
||||
## FAQ
|
||||
|
||||
Q. What about IntelliJ IDEA's own [Gradle support](https://confluence.jetbrains.net/display/IDEADEV/Gradle+integration)?
|
||||
Q. What about IntelliJ IDEA's own [Gradle support](https://www.jetbrains.com/help/idea/gradle.html)?
|
||||
|
||||
A. Keep an eye on https://youtrack.jetbrains.com/issue/IDEA-53476
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.9"
|
||||
id "io.spring.ge.conventions" version "0.0.9"
|
||||
id "com.gradle.enterprise" version "3.10.2"
|
||||
id "io.spring.ge.conventions" version "0.0.10"
|
||||
}
|
||||
|
||||
include "spring-aop"
|
||||
|
||||
@@ -63,7 +63,7 @@ public interface Joinpoint {
|
||||
/**
|
||||
* Return the static part of this joinpoint.
|
||||
* <p>The static part is an accessible object on which a chain of
|
||||
* interceptors are installed.
|
||||
* interceptors is installed.
|
||||
*/
|
||||
@Nonnull
|
||||
AccessibleObject getStaticPart();
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public interface IntroductionAwareMethodMatcher extends MethodMatcher {
|
||||
* @param targetClass the target class
|
||||
* @param hasIntroductions {@code true} if the object on whose behalf we are
|
||||
* asking is the subject on one or more introductions; {@code false} otherwise
|
||||
* @return whether or not this method matches statically
|
||||
* @return whether this method matches statically
|
||||
*/
|
||||
boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public interface MethodMatcher {
|
||||
* will be made.
|
||||
* @param method the candidate method
|
||||
* @param targetClass the target class
|
||||
* @return whether or not this method matches statically
|
||||
* @return whether this method matches statically
|
||||
*/
|
||||
boolean matches(Method method, Class<?> targetClass);
|
||||
|
||||
@@ -70,7 +70,7 @@ public interface MethodMatcher {
|
||||
* runtime even if the 2-arg matches method returns {@code true}?
|
||||
* <p>Can be invoked when an AOP proxy is created, and need not be invoked
|
||||
* again before each method invocation,
|
||||
* @return whether or not a runtime match via the 3-arg
|
||||
* @return whether a runtime match via the 3-arg
|
||||
* {@link #matches(java.lang.reflect.Method, Class, Object[])} method
|
||||
* is required if static matching passed
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.aop;
|
||||
|
||||
/**
|
||||
* Marker interface implemented by all AOP proxies. Used to detect
|
||||
* whether or not objects are Spring-generated proxies.
|
||||
* whether objects are Spring-generated proxies.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @since 2.0.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -368,7 +368,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
* to which argument name. There are multiple strategies for determining
|
||||
* this binding, which are arranged in a ChainOfResponsibility.
|
||||
*/
|
||||
public final synchronized void calculateArgumentBindings() {
|
||||
public final void calculateArgumentBindings() {
|
||||
// The simple case... nothing to bind.
|
||||
if (this.argumentsIntrospected || this.parameterTypes.length == 0) {
|
||||
return;
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import org.springframework.lang.Nullable;
|
||||
public interface AspectJAdvisorFactory {
|
||||
|
||||
/**
|
||||
* Determine whether or not the given class is an aspect, as reported
|
||||
* Determine whether the given class is an aspect, as reported
|
||||
* by AspectJ's {@link org.aspectj.lang.reflect.AjTypeSystem}.
|
||||
* <p>Will simply return {@code false} if the supposed aspect is
|
||||
* invalid (such as an extension of a concrete aspect class).
|
||||
@@ -47,7 +47,7 @@ public interface AspectJAdvisorFactory {
|
||||
* such as those with unsupported instantiation models.
|
||||
* Use the {@link #validate} method to handle these cases if necessary.
|
||||
* @param clazz the supposed annotation-style AspectJ class
|
||||
* @return whether or not this class is recognized by AspectJ as an aspect class
|
||||
* @return whether this class is recognized by AspectJ as an aspect class
|
||||
*/
|
||||
boolean isAspect(Class<?> clazz);
|
||||
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class AspectMetadata implements Serializable {
|
||||
|
||||
/**
|
||||
* Spring AOP pointcut corresponding to the per clause of the
|
||||
* aspect. Will be the Pointcut.TRUE canonical instance in the
|
||||
* aspect. Will be the {@code Pointcut.TRUE} canonical instance in the
|
||||
* case of a singleton, otherwise an AspectJExpressionPointcut.
|
||||
*/
|
||||
private final Pointcut perClausePointcut;
|
||||
|
||||
+2
-2
@@ -60,8 +60,8 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
||||
* <li>Otherwise the advice declared first gets highest precedence (i.e., runs
|
||||
* first).</li>
|
||||
* </ul>
|
||||
* <p><b>Important:</b> Advisors are sorted in precedence order, from highest
|
||||
* precedence to lowest. "On the way in" to a join point, the highest precedence
|
||||
* <p><b>Important:</b> Advisors are sorted in precedence order, from the highest
|
||||
* precedence to the lowest. "On the way in" to a join point, the highest precedence
|
||||
* advisor should run first. "On the way out" of a join point, the highest
|
||||
* precedence advisor should run last.
|
||||
*/
|
||||
|
||||
@@ -314,7 +314,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the given advisors to this proxy configuration.
|
||||
* Add all the given advisors to this proxy configuration.
|
||||
* @param advisors the advisors to register
|
||||
*/
|
||||
public void addAdvisors(Advisor... advisors) {
|
||||
@@ -322,7 +322,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the given advisors to this proxy configuration.
|
||||
* Add all the given advisors to this proxy configuration.
|
||||
* @param advisors the advisors to register
|
||||
*/
|
||||
public void addAdvisors(Collection<Advisor> advisors) {
|
||||
|
||||
@@ -72,8 +72,8 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
* NOTE: We could avoid the code duplication between this class and the CGLIB
|
||||
* proxies by refactoring "invoke" into a template method. However, this approach
|
||||
* adds at least 10% performance overhead versus a copy-paste solution, so we sacrifice
|
||||
* elegance for performance. (We have a good test suite to ensure that the different
|
||||
* proxies behave the same :-)
|
||||
* elegance for performance (we have a good test suite to ensure that the different
|
||||
* proxies behave the same :-)).
|
||||
* This way, we can also more easily take advantage of minor optimizations in each class.
|
||||
*/
|
||||
|
||||
@@ -198,7 +198,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
// Get the interception chain for this method.
|
||||
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
|
||||
|
||||
// Check whether we have any advice. If we don't, we can fallback on direct
|
||||
// Check whether we have any advice. If we don't, we can fall back on direct
|
||||
// reflective invocation of the target, and avoid creating a MethodInvocation.
|
||||
if (chain.isEmpty()) {
|
||||
// We can skip creating a MethodInvocation: just invoke the target directly
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.FactoryBean} implementation that builds an
|
||||
* AOP proxy based on beans in Spring {@link org.springframework.beans.factory.BeanFactory}.
|
||||
* AOP proxy based on beans in a Spring {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* <p>{@link org.aopalliance.intercept.MethodInterceptor MethodInterceptors} and
|
||||
* {@link org.springframework.aop.Advisor Advisors} are identified by a list of bean
|
||||
@@ -61,10 +61,11 @@ import org.springframework.util.ObjectUtils;
|
||||
*
|
||||
* <p>Global interceptors and advisors can be added at the factory level. The specified
|
||||
* ones are expanded in an interceptor list where an "xxx*" entry is included in the
|
||||
* list, matching the given prefix with the bean names (e.g. "global*" would match
|
||||
* both "globalBean1" and "globalBean2", "*" all defined interceptors). The matching
|
||||
* interceptors get applied according to their returned order value, if they implement
|
||||
* the {@link org.springframework.core.Ordered} interface.
|
||||
* list, matching the given prefix with the bean names — for example, "global*"
|
||||
* would match both "globalBean1" and "globalBean2"; whereas, "*" would match all
|
||||
* defined interceptors. The matching interceptors get applied according to their
|
||||
* returned order value, if they implement the {@link org.springframework.core.Ordered}
|
||||
* interface.
|
||||
*
|
||||
* <p>Creates a JDK proxy when proxy interfaces are given, and a CGLIB proxy for the
|
||||
* actual target class if not. Note that the latter will only work if the target class
|
||||
@@ -75,7 +76,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* This won't work for existing prototype references, which are independent. However,
|
||||
* it will work for prototypes subsequently obtained from the factory. Changes to
|
||||
* interception will work immediately on singletons (including existing references).
|
||||
* However, to change interfaces or target it's necessary to obtain a new instance
|
||||
* However, to change interfaces or a target it's necessary to obtain a new instance
|
||||
* from the factory. This means that singleton instances obtained from the factory
|
||||
* do not have the same object identity. However, they do have the same interceptors
|
||||
* and target, and changing any reference will change all objects.
|
||||
@@ -406,7 +407,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
if (namedBeanClass != null) {
|
||||
return (Advisor.class.isAssignableFrom(namedBeanClass) || Advice.class.isAssignableFrom(namedBeanClass));
|
||||
}
|
||||
// Treat it as an target bean if we can't tell.
|
||||
// Treat it as a target bean if we can't tell.
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Could not determine type of bean with name '" + beanName +
|
||||
"' - assuming it is neither an Advisor nor an Advice");
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||
private AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
|
||||
|
||||
/**
|
||||
* Indicates whether or not the proxy should be frozen. Overridden from super
|
||||
* Indicates whether the proxy should be frozen. Overridden from super
|
||||
* to prevent the configuration from becoming frozen too early.
|
||||
*/
|
||||
private boolean freezeProxy = false;
|
||||
@@ -145,9 +145,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||
|
||||
|
||||
/**
|
||||
* Set whether or not the proxy should be frozen, preventing advice
|
||||
* Set whether the proxy should be frozen, preventing advice
|
||||
* from being added to it once it is created.
|
||||
* <p>Overridden from the super class to prevent the proxy configuration
|
||||
* <p>Overridden from the superclass to prevent the proxy configuration
|
||||
* from being frozen before the proxy is created.
|
||||
*/
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
||||
protected transient Log defaultLogger = LogFactory.getLog(getClass());
|
||||
|
||||
/**
|
||||
* Indicates whether or not proxy class names should be hidden when using dynamic loggers.
|
||||
* Indicates whether proxy class names should be hidden when using dynamic loggers.
|
||||
* @see #setUseDynamicLogger
|
||||
*/
|
||||
private boolean hideProxyClassNames = false;
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether or not logging is enabled for the particular {@code MethodInvocation}.
|
||||
* Determines whether logging is enabled for the particular {@code MethodInvocation}.
|
||||
* If not, the method invocation proceeds as normal, otherwise the method invocation is passed
|
||||
* to the {@code invokeUnderTrace} method for handling.
|
||||
* @see #invokeUnderTrace(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public interface AsyncUncaughtExceptionHandler {
|
||||
* Handle the given uncaught exception thrown from an asynchronous method.
|
||||
* @param ex the exception thrown from the asynchronous method
|
||||
* @param method the asynchronous method
|
||||
* @param params the parameters used to invoked the method
|
||||
* @param params the parameters used to invoke the method
|
||||
*/
|
||||
void handleUncaughtException(Throwable ex, Method method, Object... params);
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public abstract class AopUtils {
|
||||
* out a pointcut for a class.
|
||||
* @param pc the static or dynamic pointcut to check
|
||||
* @param targetClass the class to test
|
||||
* @param hasIntroductions whether or not the advisor chain
|
||||
* @param hasIntroductions whether the advisor chain
|
||||
* for this bean includes any introductions
|
||||
* @return whether the pointcut can apply on any method
|
||||
*/
|
||||
@@ -261,7 +261,7 @@ public abstract class AopUtils {
|
||||
/**
|
||||
* Can the given advisor apply at all on the given class?
|
||||
* This is an important test as it can be used to optimize
|
||||
* out a advisor for a class.
|
||||
* out an advisor for a class.
|
||||
* @param advisor the advisor to check
|
||||
* @param targetClass class we're testing
|
||||
* @return whether the pointcut can apply on any method
|
||||
@@ -272,11 +272,11 @@ public abstract class AopUtils {
|
||||
|
||||
/**
|
||||
* Can the given advisor apply at all on the given class?
|
||||
* <p>This is an important test as it can be used to optimize out a advisor for a class.
|
||||
* <p>This is an important test as it can be used to optimize out an advisor for a class.
|
||||
* This version also takes into account introductions (for IntroductionAwareMethodMatchers).
|
||||
* @param advisor the advisor to check
|
||||
* @param targetClass class we're testing
|
||||
* @param hasIntroductions whether or not the advisor chain for this bean includes
|
||||
* @param hasIntroductions whether the advisor chain for this bean includes
|
||||
* any introductions
|
||||
* @return whether the pointcut can apply on any method
|
||||
*/
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
|
||||
|
||||
/**
|
||||
* Create an empty DefaultPointcutAdvisor.
|
||||
* <p>Advice must be set before use using setter methods.
|
||||
* <p>Advice must be set before using setter methods.
|
||||
* Pointcut will normally be set also, but defaults to {@code Pointcut.TRUE}.
|
||||
*/
|
||||
public DefaultPointcutAdvisor() {
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class MethodMatchers {
|
||||
* @param targetClass the target class
|
||||
* @param hasIntroductions {@code true} if the object on whose behalf we are
|
||||
* asking is the subject on one or more introductions; {@code false} otherwise
|
||||
* @return whether or not this method matches statically
|
||||
* @return whether this method matches statically
|
||||
*/
|
||||
public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
Assert.notNull(mm, "MethodMatcher must not be null");
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.springframework.lang.Nullable;
|
||||
* {@link AbstractPrototypeBasedTargetSource} can be used to create objects
|
||||
* in order to put them into the pool.
|
||||
*
|
||||
* <p>Subclasses must also implement some of the monitoring methods from the
|
||||
* <p>Subclasses must also implement some monitoring methods from the
|
||||
* {@link PoolingConfig} interface. The {@link #getPoolingConfigMixin()} method
|
||||
* makes these stats available on proxied objects through an IntroductionAdvisor.
|
||||
*
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -142,11 +142,11 @@ public class TrickyAspectJPointcutExpressionTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
public static @interface Log {
|
||||
@interface Log {
|
||||
}
|
||||
|
||||
|
||||
public static interface TestService {
|
||||
public interface TestService {
|
||||
|
||||
public String sayHello();
|
||||
}
|
||||
|
||||
+1
-1
@@ -931,7 +931,7 @@ abstract class AbstractMakeModifiable {
|
||||
return setter.getDeclaringClass().getMethod(getterName);
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
// must be write only
|
||||
// must be write-only
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class IntroductionBenchmarkTests {
|
||||
}
|
||||
}
|
||||
|
||||
public static interface Counter {
|
||||
public interface Counter {
|
||||
int getCount();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ public class DelegatingIntroductionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
private static interface SubTimeStamped extends TimeStamped {
|
||||
private interface SubTimeStamped extends TimeStamped {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public abstract aspect AbstractDependencyInjectionAspect {
|
||||
mostSpecificSubTypeConstruction() && !preConstructionConfiguration();
|
||||
|
||||
/**
|
||||
* Select least specific super type that is marked for DI
|
||||
* Select least specific supertype that is marked for DI
|
||||
* (so that injection occurs only once with pre-construction injection).
|
||||
*/
|
||||
public abstract pointcut leastSpecificSuperTypeConstruction();
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Signals the current application context to apply dependency injection to
|
||||
* non-managed classes that are instantiated outside of the Spring bean factory
|
||||
* non-managed classes that are instantiated outside the Spring bean factory
|
||||
* (typically classes annotated with the
|
||||
* {@link org.springframework.beans.factory.annotation.Configurable @Configurable}
|
||||
* annotation).
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
|
||||
* Obtain the property descriptor for a specific property
|
||||
* of the wrapped object.
|
||||
* @param propertyName the property to obtain the descriptor for
|
||||
* (may be a nested path, but no indexed/mapped property)
|
||||
* (may be a nested path, but not an indexed/mapped property)
|
||||
* @return the property descriptor for the specified property
|
||||
* @throws InvalidPropertyException if there is no such property
|
||||
*/
|
||||
|
||||
@@ -327,7 +327,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
/**
|
||||
* Register the specified property as "processed" in the sense
|
||||
* of some processor calling the corresponding setter method
|
||||
* outside of the PropertyValue(s) mechanism.
|
||||
* outside the PropertyValue(s) mechanism.
|
||||
* <p>This will lead to {@code true} being returned from
|
||||
* a {@link #contains} call for the specified property.
|
||||
* @param propertyName the name of the property.
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.springframework.beans;
|
||||
* {@link org.springframework.beans.PropertyEditorRegistry property editor registry}.
|
||||
*
|
||||
* <p>This is particularly useful when you need to use the same set of
|
||||
* property editors in several different situations: write a corresponding
|
||||
* property editors in several situations: write a corresponding
|
||||
* registrar and reuse that in each case.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* <p><b>The container is only responsible for managing the lifecycle of the FactoryBean
|
||||
* instance, not the lifecycle of the objects created by the FactoryBean.</b> Therefore,
|
||||
* a destroy method on an exposed bean object (such as {@link java.io.Closeable#close()}
|
||||
* a destroy method on an exposed bean object (such as {@link java.io.Closeable#close()})
|
||||
* will <i>not</i> be called automatically. Instead, a FactoryBean should implement
|
||||
* {@link DisposableBean} and delegate any such close call to the underlying object.
|
||||
*
|
||||
@@ -108,7 +108,7 @@ public interface FactoryBean<T> {
|
||||
* been fully initialized. It must not rely on state created during
|
||||
* initialization; of course, it can still use such state if available.
|
||||
* <p><b>NOTE:</b> Autowiring will simply ignore FactoryBeans that return
|
||||
* {@code null} here. Therefore it is highly recommended to implement
|
||||
* {@code null} here. Therefore, it is highly recommended to implement
|
||||
* this method properly, using the current state of the FactoryBean.
|
||||
* @return the type of object that this FactoryBean creates,
|
||||
* or {@code null} if not known at the time of the call
|
||||
|
||||
+2
-2
@@ -343,7 +343,7 @@ public interface ListableBeanFactory extends BeanFactory {
|
||||
|
||||
/**
|
||||
* Find an {@link Annotation} of {@code annotationType} on the specified bean,
|
||||
* traversing its interfaces and super classes if no annotation can be found on
|
||||
* traversing its interfaces and superclasses if no annotation can be found on
|
||||
* the given class itself, as well as checking the bean's factory method (if any).
|
||||
* @param beanName the name of the bean to look for annotations on
|
||||
* @param annotationType the type of annotation to look for
|
||||
@@ -361,7 +361,7 @@ public interface ListableBeanFactory extends BeanFactory {
|
||||
|
||||
/**
|
||||
* Find an {@link Annotation} of {@code annotationType} on the specified bean,
|
||||
* traversing its interfaces and super classes if no annotation can be found on
|
||||
* traversing its interfaces and superclasses if no annotation can be found on
|
||||
* the given class itself, as well as checking the bean's factory method (if any).
|
||||
* @param beanName the name of the bean to look for annotations on
|
||||
* @param annotationType the type of annotation to look for
|
||||
|
||||
+2
-2
@@ -137,7 +137,7 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
|
||||
* as a <em>qualifier</em>, the bean must 'match' against the annotation as
|
||||
* well as any attributes it may contain. The bean definition must contain
|
||||
* the same qualifier or match by meta attributes. A "value" attribute will
|
||||
* fallback to match against the bean name or an alias if a qualifier or
|
||||
* fall back to match against the bean name or an alias if a qualifier or
|
||||
* attribute does not match.
|
||||
* @see Qualifier
|
||||
*/
|
||||
@@ -186,7 +186,7 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
|
||||
if (isQualifier(metaType)) {
|
||||
foundMeta = true;
|
||||
// Only accept fallback match if @Qualifier annotation has a value...
|
||||
// Otherwise it is just a marker for a custom qualifier annotation.
|
||||
// Otherwise, it is just a marker for a custom qualifier annotation.
|
||||
if ((fallbackToMeta && ObjectUtils.isEmpty(AnnotationUtils.getValue(metaAnn))) ||
|
||||
!checkQualifier(bdHolder, metaAnn, typeConverter)) {
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.springframework.beans.BeansException;
|
||||
*
|
||||
* <p>A {@code BeanFactoryPostProcessor} may interact with and modify bean
|
||||
* definitions, but never bean instances. Doing so may cause premature bean
|
||||
* instantiation, violating the container and causing unintended side-effects.
|
||||
* instantiation, violating the container and causing unintended side effects.
|
||||
* If bean instance interaction is required, consider implementing
|
||||
* {@link BeanPostProcessor} instead.
|
||||
*
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class ConstructorArgumentValues {
|
||||
|
||||
/**
|
||||
* Copy all given argument values into this object, using separate holder
|
||||
* instances to keep the values independent from the original object.
|
||||
* instances to keep the values independent of the original object.
|
||||
* <p>Note: Identical ValueHolder instances will only be registered once,
|
||||
* to allow for merging and re-merging of argument value definitions. Distinct
|
||||
* ValueHolder instances carrying the same content are of course allowed.
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ public abstract class YamlProcessor {
|
||||
* resources. Each resource is parsed in turn and the documents inside checked against
|
||||
* the {@link #setDocumentMatchers(DocumentMatcher...) matchers}. If a document
|
||||
* matches it is passed into the callback, along with its representation as Properties.
|
||||
* Depending on the {@link #setResolutionMethod(ResolutionMethod)} not all of the
|
||||
* Depending on the {@link #setResolutionMethod(ResolutionMethod)} not all the
|
||||
* documents will be parsed.
|
||||
* @param callback a callback to delegate to once matching documents are found
|
||||
* @see #createYaml()
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementations expects the other object to be of type BeanComponentDefinition
|
||||
* This implementation expects the other object to be of type BeanComponentDefinition
|
||||
* as well, in addition to the superclass's equality requirements.
|
||||
*/
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -50,13 +50,13 @@ import org.springframework.beans.factory.config.BeanReference;
|
||||
* {@link #getBeanReferences}, tools may wish to inspect all {@link BeanDefinition BeanDefinitions} to gather
|
||||
* the full set of {@link BeanReference BeanReferences}. Implementations are required to provide
|
||||
* all {@link BeanReference BeanReferences} that are required to validate the configuration of the
|
||||
* overall logical entity as well as those required to provide full user visualisation of the configuration.
|
||||
* overall logical entity as well as those required to provide full user visualization of the configuration.
|
||||
* It is expected that certain {@link BeanReference BeanReferences} will not be important to
|
||||
* validation or to the user view of the configuration and as such these may be omitted. A tool may wish to
|
||||
* display any additional {@link BeanReference BeanReferences} sourced through the supplied
|
||||
* {@link BeanDefinition BeanDefinitions} but this is not considered to be a typical case.
|
||||
*
|
||||
* <p>Tools can determine the important of contained {@link BeanDefinition BeanDefinitions} by checking the
|
||||
* <p>Tools can determine the importance of contained {@link BeanDefinition BeanDefinitions} by checking the
|
||||
* {@link BeanDefinition#getRole role identifier}. The role is essentially a hint to the tool as to how
|
||||
* important the configuration provider believes a {@link BeanDefinition} is to the end user. It is expected
|
||||
* that tools will <strong>not</strong> display all {@link BeanDefinition BeanDefinitions} for a given
|
||||
|
||||
+1
-1
@@ -1510,7 +1510,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
try {
|
||||
PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
|
||||
// Don't try autowiring by type for type Object: never makes sense,
|
||||
// even if it technically is a unsatisfied, non-simple property.
|
||||
// even if it technically is an unsatisfied, non-simple property.
|
||||
if (Object.class != pd.getPropertyType()) {
|
||||
MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
|
||||
// Do not allow eager init for type matching in case of a prioritized post-processor.
|
||||
|
||||
+2
-2
@@ -945,7 +945,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether or not the configured initializer method is the default.
|
||||
* Specify whether the configured initializer method is the default.
|
||||
* <p>The default value is {@code true} for a locally specified init method
|
||||
* but switched to {@code false} for a shared setting in a defaults section
|
||||
* (e.g. {@code bean init-method} versus {@code beans default-init-method}
|
||||
@@ -984,7 +984,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether or not the configured destroy method is the default.
|
||||
* Specify whether the configured destroy method is the default.
|
||||
* <p>The default value is {@code true} for a locally specified destroy method
|
||||
* but switched to {@code false} for a shared setting in a defaults section
|
||||
* (e.g. {@code bean destroy-method} versus {@code beans default-destroy-method}
|
||||
|
||||
+1
-1
@@ -593,7 +593,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
|
||||
|
||||
// Setup the types that we want to match against
|
||||
// Set up the types that we want to match against
|
||||
Class<?> classToMatch = typeToMatch.resolve();
|
||||
if (classToMatch == null) {
|
||||
classToMatch = FactoryBean.class;
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ public final class BeanDefinitionBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not this definition is abstract.
|
||||
* Set whether this definition is abstract.
|
||||
*/
|
||||
public BeanDefinitionBuilder setAbstract(boolean flag) {
|
||||
this.beanDefinition.setAbstract(flag);
|
||||
|
||||
+16
-11
@@ -280,7 +280,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dependency comparator for this BeanFactory (may be {@code null}.
|
||||
* Return the dependency comparator for this BeanFactory (may be {@code null}).
|
||||
* @since 4.0
|
||||
*/
|
||||
@Nullable
|
||||
@@ -2167,20 +2167,25 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
@Nullable
|
||||
public Object getOrderSource(Object obj) {
|
||||
String beanName = this.instancesToBeanNames.get(obj);
|
||||
if (beanName == null || !containsBeanDefinition(beanName)) {
|
||||
if (beanName == null) {
|
||||
return null;
|
||||
}
|
||||
RootBeanDefinition beanDefinition = getMergedLocalBeanDefinition(beanName);
|
||||
List<Object> sources = new ArrayList<>(2);
|
||||
Method factoryMethod = beanDefinition.getResolvedFactoryMethod();
|
||||
if (factoryMethod != null) {
|
||||
sources.add(factoryMethod);
|
||||
try {
|
||||
RootBeanDefinition beanDefinition = (RootBeanDefinition) getMergedBeanDefinition(beanName);
|
||||
List<Object> sources = new ArrayList<>(2);
|
||||
Method factoryMethod = beanDefinition.getResolvedFactoryMethod();
|
||||
if (factoryMethod != null) {
|
||||
sources.add(factoryMethod);
|
||||
}
|
||||
Class<?> targetType = beanDefinition.getTargetType();
|
||||
if (targetType != null && targetType != obj.getClass()) {
|
||||
sources.add(targetType);
|
||||
}
|
||||
return sources.toArray();
|
||||
}
|
||||
Class<?> targetType = beanDefinition.getTargetType();
|
||||
if (targetType != null && targetType != obj.getClass()) {
|
||||
sources.add(targetType);
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
return null;
|
||||
}
|
||||
return sources.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import org.springframework.util.ClassUtils;
|
||||
/**
|
||||
* Basic {@link AutowireCandidateResolver} that performs a full generic type
|
||||
* match with the candidate's type if the dependency is declared as a generic type
|
||||
* (e.g. Repository<Customer>).
|
||||
* (e.g. {@code Repository<Customer>}).
|
||||
*
|
||||
* <p>This is the base class for
|
||||
* {@link org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver},
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public abstract class AbstractBeanDefinitionParser implements BeanDefinitionPars
|
||||
/**
|
||||
* Register the supplied {@link BeanDefinitionHolder bean} with the supplied
|
||||
* {@link BeanDefinitionRegistry registry}.
|
||||
* <p>Subclasses can override this method to control whether or not the supplied
|
||||
* <p>Subclasses can override this method to control whether the supplied
|
||||
* {@link BeanDefinitionHolder bean} is actually even registered, or to
|
||||
* register even more beans.
|
||||
* <p>The default implementation registers the supplied {@link BeanDefinitionHolder bean}
|
||||
|
||||
+2
-2
@@ -1362,7 +1362,7 @@ public class BeanDefinitionParserDelegate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a custom element (outside of the default namespace).
|
||||
* Parse a custom element (outside the default namespace).
|
||||
* @param ele the element to parse
|
||||
* @return the resulting bean definition
|
||||
*/
|
||||
@@ -1372,7 +1372,7 @@ public class BeanDefinitionParserDelegate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a custom element (outside of the default namespace).
|
||||
* Parse a custom element (outside the default namespace).
|
||||
* @param ele the element to parse
|
||||
* @param containingBd the containing bean definition (if any)
|
||||
* @return the resulting bean definition
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
|
||||
* Create a new {@code DefaultNamespaceHandlerResolver} using the
|
||||
* supplied mapping file location.
|
||||
* @param classLoader the {@link ClassLoader} instance used to load mapping resources
|
||||
* may be {@code null}, in which case the thread context ClassLoader will be used)
|
||||
* may be {@code null}, in which case the thread context ClassLoader will be used
|
||||
* @param handlerMappingsLocation the mapping file location
|
||||
*/
|
||||
public DefaultNamespaceHandlerResolver(@Nullable ClassLoader classLoader, String handlerMappingsLocation) {
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class DelegatingEntityResolver implements EntityResolver {
|
||||
* <p>Configures the {@link PluggableSchemaResolver} with the supplied
|
||||
* {@link ClassLoader}.
|
||||
* @param classLoader the ClassLoader to use for loading
|
||||
* (can be {@code null}) to use the default ClassLoader)
|
||||
* (can be {@code null} to use the default ClassLoader)
|
||||
*/
|
||||
public DelegatingEntityResolver(@Nullable ClassLoader classLoader) {
|
||||
this.dtdResolver = new BeansDtdResolver();
|
||||
|
||||
+2
-2
@@ -80,7 +80,7 @@ public class PluggableSchemaResolver implements EntityResolver {
|
||||
* Loads the schema URL → schema file location mappings using the default
|
||||
* mapping file pattern "META-INF/spring.schemas".
|
||||
* @param classLoader the ClassLoader to use for loading
|
||||
* (can be {@code null}) to use the default ClassLoader)
|
||||
* (can be {@code null} to use the default ClassLoader)
|
||||
* @see PropertiesLoaderUtils#loadAllProperties(String, ClassLoader)
|
||||
*/
|
||||
public PluggableSchemaResolver(@Nullable ClassLoader classLoader) {
|
||||
@@ -92,7 +92,7 @@ public class PluggableSchemaResolver implements EntityResolver {
|
||||
* Loads the schema URL → schema file location mappings using the given
|
||||
* mapping file pattern.
|
||||
* @param classLoader the ClassLoader to use for loading
|
||||
* (can be {@code null}) to use the default ClassLoader)
|
||||
* (can be {@code null} to use the default ClassLoader)
|
||||
* @param schemaMappingsLocation the location of the file that defines schema mappings
|
||||
* (must not be empty)
|
||||
* @see PropertiesLoaderUtils#loadAllProperties(String, ClassLoader)
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ import org.springframework.util.StringUtils;
|
||||
* the bean that will be considered as a parameter.
|
||||
*
|
||||
* <b>Note</b>: This implementation supports only named parameters - there is no
|
||||
* support for indexes or types. Further more, the names are used as hints by
|
||||
* support for indexes or types. Furthermore, the names are used as hints by
|
||||
* the container which, by default, does type introspection.
|
||||
*
|
||||
* @author Costin Leau
|
||||
|
||||
+2
-2
@@ -184,7 +184,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not the XML parser should be XML namespace aware.
|
||||
* Set whether the XML parser should be XML namespace aware.
|
||||
* Default is "false".
|
||||
* <p>This is typically not needed when schema validation is active.
|
||||
* However, without validation, this has to be switched to "true"
|
||||
@@ -195,7 +195,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether or not the XML parser should be XML namespace aware.
|
||||
* Return whether the XML parser should be XML namespace aware.
|
||||
*/
|
||||
public boolean isNamespaceAware() {
|
||||
return this.namespaceAware;
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
* e.g. {@code UTF-8}, {@code ISO-8859-16}, etc.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Sam Brannen
|
||||
* @since 2.5.4
|
||||
* @see Charset
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class CharsetEditor extends PropertyEditorSupport {
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
setValue(Charset.forName(text));
|
||||
setValue(Charset.forName(text.trim()));
|
||||
}
|
||||
else {
|
||||
setValue(null);
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,11 +19,14 @@ package org.springframework.beans.propertyeditors;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Currency;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Editor for {@code java.util.Currency}, translating currency codes into Currency
|
||||
* objects. Exposes the currency code as text representation of a Currency object.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
* @see java.util.Currency
|
||||
*/
|
||||
@@ -31,6 +34,9 @@ public class CurrencyEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
text = text.trim();
|
||||
}
|
||||
setValue(Currency.getInstance(text));
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
|
||||
* Custom {@link java.beans.PropertyEditor} for String arrays.
|
||||
*
|
||||
* <p>Strings must be in CSV format, with a customizable separator.
|
||||
* By default values in the result are trimmed of whitespace.
|
||||
* By default, values in the result are trimmed of whitespace.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
@@ -86,7 +86,7 @@ public class StringArrayPropertyEditor extends PropertyEditorSupport {
|
||||
* @param emptyArrayAsNull {@code true} if an empty String array
|
||||
* is to be transformed into {@code null}
|
||||
* @param trimValues {@code true} if the values in the parsed arrays
|
||||
* are to be trimmed of whitespace (default is true)
|
||||
* are to be trimmed of whitespace (default is {@code true})
|
||||
*/
|
||||
public StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull, boolean trimValues) {
|
||||
this(separator, null, emptyArrayAsNull, trimValues);
|
||||
@@ -114,7 +114,7 @@ public class StringArrayPropertyEditor extends PropertyEditorSupport {
|
||||
* @param emptyArrayAsNull {@code true} if an empty String array
|
||||
* is to be transformed into {@code null}
|
||||
* @param trimValues {@code true} if the values in the parsed arrays
|
||||
* are to be trimmed of whitespace (default is true)
|
||||
* are to be trimmed of whitespace (default is {@code true})
|
||||
*/
|
||||
public StringArrayPropertyEditor(
|
||||
String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull, boolean trimValues) {
|
||||
|
||||
+5
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Nicholas Williams
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
* @see java.util.TimeZone
|
||||
* @see ZoneIdEditor
|
||||
@@ -36,6 +37,9 @@ public class TimeZoneEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
text = text.trim();
|
||||
}
|
||||
setValue(StringUtils.parseTimeZoneString(text));
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class URIEditor extends PropertyEditorSupport {
|
||||
|
||||
/**
|
||||
* Create a URI instance for the given user-specified String value.
|
||||
* <p>The default implementation encodes the value into a RFC-2396 compliant URI.
|
||||
* <p>The default implementation encodes the value into an RFC-2396 compliant URI.
|
||||
* @param value the value to convert into a URI instance
|
||||
* @return the URI instance
|
||||
* @throws java.net.URISyntaxException if URI conversion failed
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,11 +19,14 @@ package org.springframework.beans.propertyeditors;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Editor for {@code java.time.ZoneId}, translating zone ID Strings into {@code ZoneId}
|
||||
* objects. Exposes the {@code TimeZone} ID as a text representation.
|
||||
*
|
||||
* @author Nicholas Williams
|
||||
* @author Sam Brannen
|
||||
* @since 4.0
|
||||
* @see java.time.ZoneId
|
||||
* @see TimeZoneEditor
|
||||
@@ -32,6 +35,9 @@ public class ZoneIdEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
text = text.trim();
|
||||
}
|
||||
setValue(ZoneId.of(text));
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ class BeanUtilsTests {
|
||||
* {@code Number} can NOT be copied to {@code Integer}.
|
||||
*/
|
||||
@Test
|
||||
void copyPropertiesDoesNotCopyeFromSuperTypeToSubType() {
|
||||
void copyPropertiesDoesNotCopyFromSuperTypeToSubType() {
|
||||
NumberHolder numberHolder = new NumberHolder();
|
||||
numberHolder.setNumber(Integer.valueOf(42));
|
||||
IntegerHolder integerHolder = new IntegerHolder();
|
||||
|
||||
+15
@@ -1982,6 +1982,21 @@ class DefaultListableBeanFactoryTests {
|
||||
assertThat(bean.getSpouse()).isEqualTo(lbf.getBean("spouse"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanProviderWithParentBeanFactoryReuseOrder() {
|
||||
DefaultListableBeanFactory parentBf = new DefaultListableBeanFactory();
|
||||
parentBf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE);
|
||||
parentBf.registerBeanDefinition("regular", new RootBeanDefinition(TestBean.class));
|
||||
parentBf.registerBeanDefinition("test", new RootBeanDefinition(HighPriorityTestBean.class));
|
||||
lbf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE);
|
||||
lbf.setParentBeanFactory(parentBf);
|
||||
lbf.registerBeanDefinition("low", new RootBeanDefinition(LowPriorityTestBean.class));
|
||||
List<Class<?>> orderedTypes = lbf.getBeanProvider(TestBean.class).orderedStream()
|
||||
.map(Object::getClass).collect(Collectors.toList());
|
||||
assertThat(orderedTypes).containsExactly(
|
||||
HighPriorityTestBean.class, LowPriorityTestBean.class, TestBean.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void autowireExistingBeanByName() {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class MethodInvokingFactoryBeanTests {
|
||||
@Test
|
||||
public void testParameterValidation() throws Exception {
|
||||
|
||||
// assert that only static OR non static are set, but not both or none
|
||||
// assert that only static OR non-static are set, but not both or none
|
||||
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
|
||||
assertThatIllegalArgumentException().isThrownBy(mcfb::afterPropertiesSet);
|
||||
|
||||
|
||||
+5
-5
@@ -278,19 +278,19 @@ public class ServiceLocatorFactoryBeanTests {
|
||||
}
|
||||
|
||||
|
||||
public static interface TestServiceLocator {
|
||||
public interface TestServiceLocator {
|
||||
|
||||
TestService getTestService();
|
||||
}
|
||||
|
||||
|
||||
public static interface TestServiceLocator2 {
|
||||
public interface TestServiceLocator2 {
|
||||
|
||||
TestService getTestService(String id) throws CustomServiceLocatorException2;
|
||||
}
|
||||
|
||||
|
||||
public static interface TestServiceLocator3 {
|
||||
public interface TestServiceLocator3 {
|
||||
|
||||
TestService getTestService();
|
||||
|
||||
@@ -302,13 +302,13 @@ public class ServiceLocatorFactoryBeanTests {
|
||||
}
|
||||
|
||||
|
||||
public static interface TestService2Locator {
|
||||
public interface TestService2Locator {
|
||||
|
||||
TestService2 getTestService() throws CustomServiceLocatorException3;
|
||||
}
|
||||
|
||||
|
||||
public static interface ServiceLocatorInterfaceWithExtraNonCompliantMethod {
|
||||
public interface ServiceLocatorInterfaceWithExtraNonCompliantMethod {
|
||||
|
||||
TestService2 getTestService();
|
||||
|
||||
|
||||
+15
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,19 +19,26 @@ package org.springframework.beans.propertyeditors;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Nicholas Williams
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class ZoneIdEditorTests {
|
||||
class ZoneIdEditorTests {
|
||||
|
||||
private final ZoneIdEditor editor = new ZoneIdEditor();
|
||||
|
||||
@Test
|
||||
public void americaChicago() {
|
||||
editor.setAsText("America/Chicago");
|
||||
@ParameterizedTest(name = "[{index}] text = ''{0}''")
|
||||
@ValueSource(strings = {
|
||||
"America/Chicago",
|
||||
" America/Chicago ",
|
||||
})
|
||||
void americaChicago(String text) {
|
||||
editor.setAsText(text);
|
||||
|
||||
ZoneId zoneId = (ZoneId) editor.getValue();
|
||||
assertThat(zoneId).as("The zone ID should not be null.").isNotNull();
|
||||
@@ -41,7 +48,7 @@ public class ZoneIdEditorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void americaLosAngeles() {
|
||||
void americaLosAngeles() {
|
||||
editor.setAsText("America/Los_Angeles");
|
||||
|
||||
ZoneId zoneId = (ZoneId) editor.getValue();
|
||||
@@ -52,12 +59,12 @@ public class ZoneIdEditorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNullAsText() {
|
||||
void getNullAsText() {
|
||||
assertThat(editor.getAsText()).as("The returned value is not correct.").isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getValueAsText() {
|
||||
void getValueAsText() {
|
||||
editor.setValue(ZoneId.of("America/New_York"));
|
||||
assertThat(editor.getAsText()).as("The text version is not correct.").isEqualTo("America/New_York");
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
* Interface used for {@link org.springframework.beans.testfixture.beans.TestBean}.
|
||||
*
|
||||
* <p>Two methods are the same as on Person, but if this
|
||||
* extends person it breaks quite a few tests..
|
||||
* extends person it breaks quite a few tests.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ class TypeHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the super class of the specified {@link Element} or null if this
|
||||
* Return the superclass of the specified {@link Element} or null if this
|
||||
* {@code element} represents {@link Object}.
|
||||
*/
|
||||
public Element getSuperClass(Element element) {
|
||||
@@ -100,7 +100,7 @@ class TypeHelper {
|
||||
public List<Element> getDirectInterfaces(Element element) {
|
||||
List<? extends TypeMirror> superTypes = this.types.directSupertypes(element.asType());
|
||||
List<Element> directInterfaces = new ArrayList<>();
|
||||
if (superTypes.size() > 1) { // index 0 is the super class
|
||||
if (superTypes.size() > 1) { // index 0 is the superclass
|
||||
for (int i = 1; i < superTypes.size(); i++) {
|
||||
Element e = this.types.asElement(superTypes.get(i));
|
||||
if (e != null) {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.springframework.context.index.sample;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Candidate with a inner class that isn't static (and should therefore not be added).
|
||||
* Candidate with an inner class that isn't static (and should therefore not be added).
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
|
||||
* {@code CacheResolver} from a custom {@code CacheResolver} implementation so we have to
|
||||
* fall back on the {@code CacheManager}.
|
||||
* <p>This gives this weird situation of a perfectly valid configuration that breaks all
|
||||
* the sudden because the JCache support is enabled. To avoid this we resolve the default
|
||||
* of a sudden because the JCache support is enabled. To avoid this we resolve the default
|
||||
* exception {@code CacheResolver} as late as possible to avoid such hard requirement
|
||||
* in other cases.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Cache decorator which synchronizes its {@link #put}, {@link #evict} and
|
||||
* {@link #clear} operations with Spring-managed transactions (through Spring's
|
||||
* {@link TransactionSynchronizationManager}, performing the actual cache
|
||||
* {@link TransactionSynchronizationManager}), performing the actual cache
|
||||
* put/evict/clear operation only in the after-commit phase of a successful
|
||||
* transaction. If no transaction is active, {@link #put}, {@link #evict} and
|
||||
* {@link #clear} operations will be performed immediately, as usual.
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Proxy for a target {@link CacheManager}, exposing transaction-aware {@link Cache} objects
|
||||
* which synchronize their {@link Cache#put} operations with Spring-managed transactions
|
||||
* (through Spring's {@link org.springframework.transaction.support.TransactionSynchronizationManager},
|
||||
* (through Spring's {@link org.springframework.transaction.support.TransactionSynchronizationManager}),
|
||||
* performing the actual cache put operation only in the after-commit phase of a successful transaction.
|
||||
* If no transaction is active, {@link Cache#put} operations will be performed immediately, as usual.
|
||||
*
|
||||
|
||||
+3
-3
@@ -132,10 +132,10 @@ public class JavaMailSenderImpl implements JavaMailSender {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow Map access to the JavaMail properties of this sender,
|
||||
* Allow {code Map} access to the JavaMail properties of this sender,
|
||||
* with the option to add or override specific entries.
|
||||
* <p>Useful for specifying entries directly, for example via
|
||||
* "javaMailProperties[mail.smtp.auth]".
|
||||
* {code javaMailProperties[mail.smtp.auth]}.
|
||||
*/
|
||||
public Properties getJavaMailProperties() {
|
||||
return this.javaMailProperties;
|
||||
@@ -156,7 +156,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
|
||||
|
||||
/**
|
||||
* Return the JavaMail {@code Session},
|
||||
* lazily initializing it if hasn't been specified explicitly.
|
||||
* lazily initializing it if it hasn't been specified explicitly.
|
||||
*/
|
||||
public synchronized Session getSession() {
|
||||
if (this.session == null) {
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public class JobDetailFactoryBean
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recovery flag for this job, i.e. whether or not the job should
|
||||
* Set the recovery flag for this job, i.e. whether the job should
|
||||
* get re-executed if a 'recovery' or 'fail-over' situation is encountered.
|
||||
*/
|
||||
public void setRequestsRecovery(boolean requestsRecovery) {
|
||||
|
||||
+2
-2
@@ -119,7 +119,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether or not multiple jobs should be run in a concurrent fashion.
|
||||
* Specify whether multiple jobs should be run in a concurrent fashion.
|
||||
* The behavior when one does not want concurrent jobs to be executed is
|
||||
* realized through adding the {@code @PersistJobDataAfterExecution} and
|
||||
* {@code @DisallowConcurrentExecution} markers.
|
||||
@@ -286,7 +286,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
|
||||
|
||||
/**
|
||||
* Extension of the MethodInvokingJob, implementing the StatefulJob interface.
|
||||
* Quartz checks whether or not jobs are stateful and if so,
|
||||
* Quartz checks whether jobs are stateful and if so,
|
||||
* won't let jobs interfere with each other.
|
||||
*/
|
||||
@PersistJobDataAfterExecution
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ import org.springframework.beans.PropertyAccessorFactory;
|
||||
* <p><b>Note that the preferred way to apply dependency injection
|
||||
* to Job instances is via a JobFactory:</b> that is, to specify
|
||||
* {@link SpringBeanJobFactory} as Quartz JobFactory (typically via
|
||||
* {@link SchedulerFactoryBean#setJobFactory} SchedulerFactoryBean's "jobFactory" property}).
|
||||
* {@link SchedulerFactoryBean#setJobFactory SchedulerFactoryBean's "jobFactory" property}).
|
||||
* This allows to implement dependency-injected Quartz Jobs without
|
||||
* a dependency on Spring base classes.
|
||||
*
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ video/x-msvideo avi
|
||||
################################################################################
|
||||
#
|
||||
# Additional file types adapted from
|
||||
# http://sites.utoronto.ca/webdocs/HTMLdocs/Book/Book-3ed/appb/mimetype.html
|
||||
# https://web.archive.org/web/20220119153325/http%3A//sites.utoronto.ca/webdocs/HTMLdocs/Book/Book-3ed/appb/mimetype.html
|
||||
# kindly re-licensed to Apache Software License 2.0 by Ian Graham.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
+2
-2
@@ -354,7 +354,7 @@ public abstract class AbstractJCacheAnnotationTests {
|
||||
|
||||
assertThatNullPointerException().isThrownBy(() ->
|
||||
service.earlyRemoveWithException(this.keyItem, false));
|
||||
// This will be remove anyway as the earlyRemove has removed the cache before
|
||||
// This will be removed anyway as the earlyRemove has removed the cache before
|
||||
assertThat(cache.get(key)).isNull();
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ public abstract class AbstractJCacheAnnotationTests {
|
||||
|
||||
assertThatNullPointerException().isThrownBy(() ->
|
||||
service.earlyRemoveAllWithException(false));
|
||||
// This will be remove anyway as the earlyRemove has removed the cache before
|
||||
// This will be removed anyway as the earlyRemove has removed the cache before
|
||||
assertThat(isEmpty(cache)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,7 @@ import org.springframework.lang.Nullable;
|
||||
* Interface that defines common cache operations.
|
||||
*
|
||||
* <b>Note:</b> Due to the generic use of caching, it is recommended that
|
||||
* implementations allow storage of <tt>null</tt> values (for example to
|
||||
* implementations allow storage of {@code null} values (for example to
|
||||
* cache methods that return {@code null}).
|
||||
*
|
||||
* @author Costin Leau
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -111,7 +111,8 @@ public @interface CacheEvict {
|
||||
|
||||
/**
|
||||
* Spring Expression Language (SpEL) expression used for making the cache
|
||||
* eviction operation conditional.
|
||||
* eviction operation conditional. Evict that cache if the condition evaluates
|
||||
* to {@code true}.
|
||||
* <p>Default is {@code ""}, meaning the cache eviction is always performed.
|
||||
* <p>The SpEL expression evaluates against a dedicated context that provides the
|
||||
* following meta-data:
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -118,7 +118,8 @@ public @interface CachePut {
|
||||
|
||||
/**
|
||||
* Spring Expression Language (SpEL) expression used for making the cache
|
||||
* put operation conditional.
|
||||
* put operation conditional. Update the cache if the condition evaluates to
|
||||
* {@code true}.
|
||||
* <p>This expression is evaluated after the method has been called due to the
|
||||
* nature of the put operation and can therefore refer to the {@code result}.
|
||||
* <p>Default is {@code ""}, meaning the method result is always cached.
|
||||
@@ -142,6 +143,7 @@ public @interface CachePut {
|
||||
|
||||
/**
|
||||
* Spring Expression Language (SpEL) expression used to veto the cache put operation.
|
||||
* Veto updating the cache if the condition evaluates to {@code true}.
|
||||
* <p>Default is {@code ""}, meaning that caching is never vetoed.
|
||||
* <p>The SpEL expression evaluates against a dedicated context that provides the
|
||||
* following meta-data:
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -123,7 +123,8 @@ public @interface Cacheable {
|
||||
|
||||
/**
|
||||
* Spring Expression Language (SpEL) expression used for making the method
|
||||
* caching conditional.
|
||||
* caching conditional. Cache the result if the condition evaluates to
|
||||
* {@code true}.
|
||||
* <p>Default is {@code ""}, meaning the method result is always cached.
|
||||
* <p>The SpEL expression evaluates against a dedicated context that provides the
|
||||
* following meta-data:
|
||||
@@ -142,6 +143,7 @@ public @interface Cacheable {
|
||||
|
||||
/**
|
||||
* Spring Expression Language (SpEL) expression used to veto method caching.
|
||||
* Veto caching the result if the condition evaluates to {@code true}.
|
||||
* <p>Unlike {@link #condition}, this expression is evaluated after the method
|
||||
* has been called and can therefore refer to the {@code result}.
|
||||
* <p>Default is {@code ""}, meaning that caching is never vetoed.
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* An implementation of {@link CachingConfigurer} with empty methods allowing
|
||||
* sub-classes to override only the methods they're interested in.
|
||||
* subclasses to override only the methods they're interested in.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 4.1
|
||||
|
||||
Vendored
+1
-1
@@ -200,7 +200,7 @@ public class SpringCacheAnnotationParser implements CacheAnnotationParser, Seria
|
||||
/**
|
||||
* Validates the specified {@link CacheOperation}.
|
||||
* <p>Throws an {@link IllegalStateException} if the state of the operation is
|
||||
* invalid. As there might be multiple sources for default values, this ensure
|
||||
* invalid. As there might be multiple sources for default values, this ensures
|
||||
* that the operation is in a proper state before being returned.
|
||||
* @param ae the annotated element of the cache operation
|
||||
* @param operation the {@link CacheOperation} to validate
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ import org.springframework.lang.Nullable;
|
||||
* are present.
|
||||
*
|
||||
* <p>To limit the creation of objects, an ugly constructor is used
|
||||
* (rather then a dedicated 'closure'-like class for deferred execution).
|
||||
* (rather than a dedicated 'closure'-like class for deferred execution).
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Stephane Nicoll
|
||||
|
||||
Vendored
+78
-33
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cache.interceptor;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -24,82 +26,125 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link CacheErrorHandler} implementation that logs error message. Can be
|
||||
* used when underlying cache errors should be ignored.
|
||||
* A {@link CacheErrorHandler} implementation that logs error messages.
|
||||
*
|
||||
* <p>Can be used when underlying cache errors should be ignored.
|
||||
*
|
||||
* @author Adam Ostrožlík
|
||||
* @author Stephane Nicoll
|
||||
* @author Vedran Pavic
|
||||
* @author Sam Brannen
|
||||
* @since 5.3.16
|
||||
*/
|
||||
public class LoggingCacheErrorHandler implements CacheErrorHandler {
|
||||
|
||||
private final Log logger;
|
||||
|
||||
private final boolean logStacktrace;
|
||||
private final boolean logStackTraces;
|
||||
|
||||
|
||||
/**
|
||||
* Create an instance with the {@link Log logger} to use.
|
||||
* @param logger the logger to use
|
||||
* @param logStacktrace whether to log stack trace
|
||||
* Create a {@code LoggingCacheErrorHandler} that uses the default logging
|
||||
* category and does not log stack traces.
|
||||
* <p>The default logging category is
|
||||
* "{@code org.springframework.cache.interceptor.LoggingCacheErrorHandler}".
|
||||
*/
|
||||
public LoggingCacheErrorHandler(Log logger, boolean logStacktrace) {
|
||||
Assert.notNull(logger, "Logger must not be null");
|
||||
this.logger = logger;
|
||||
this.logStacktrace = logStacktrace;
|
||||
public LoggingCacheErrorHandler() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance that does not log stack traces.
|
||||
* Create a {@code LoggingCacheErrorHandler} that uses the default logging
|
||||
* category and the supplied {@code logStackTraces} flag.
|
||||
* <p>The default logging category is
|
||||
* "{@code org.springframework.cache.interceptor.LoggingCacheErrorHandler}".
|
||||
* @param logStackTraces whether to log stack traces
|
||||
* @since 5.3.22
|
||||
*/
|
||||
public LoggingCacheErrorHandler() {
|
||||
this(LogFactory.getLog(LoggingCacheErrorHandler.class), false);
|
||||
public LoggingCacheErrorHandler(boolean logStackTraces) {
|
||||
this(LogFactory.getLog(LoggingCacheErrorHandler.class), logStackTraces);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code LoggingCacheErrorHandler} that uses the supplied
|
||||
* {@link Log logger} and {@code logStackTraces} flag.
|
||||
* @param logger the logger to use
|
||||
* @param logStackTraces whether to log stack traces
|
||||
*/
|
||||
public LoggingCacheErrorHandler(Log logger, boolean logStackTraces) {
|
||||
Assert.notNull(logger, "'logger' must not be null");
|
||||
this.logger = logger;
|
||||
this.logStackTraces = logStackTraces;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleCacheGetError(RuntimeException exception, Cache cache, Object key) {
|
||||
logCacheError(logger,
|
||||
createMessage(cache, "failed to get entry with key '" + key + "'"),
|
||||
logCacheError(
|
||||
() -> String.format("Cache '%s' failed to get entry with key '%s'", cache.getName(), key),
|
||||
exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCachePutError(RuntimeException exception, Cache cache, Object key, @Nullable Object value) {
|
||||
logCacheError(logger,
|
||||
createMessage(cache, "failed to put entry with key '" + key + "'"),
|
||||
logCacheError(
|
||||
() -> String.format("Cache '%s' failed to put entry with key '%s'", cache.getName(), key),
|
||||
exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCacheEvictError(RuntimeException exception, Cache cache, Object key) {
|
||||
logCacheError(logger,
|
||||
createMessage(cache, "failed to evict entry with key '" + key + "'"),
|
||||
logCacheError(
|
||||
() -> String.format("Cache '%s' failed to evict entry with key '%s'", cache.getName(), key),
|
||||
exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCacheClearError(RuntimeException exception, Cache cache) {
|
||||
logCacheError(logger, createMessage(cache, "failed to clear entries"), exception);
|
||||
logCacheError(
|
||||
() -> String.format("Cache '%s' failed to clear entries", cache.getName()),
|
||||
exception);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the logger for this {@code LoggingCacheErrorHandler}.
|
||||
* @return the logger
|
||||
* @since 5.3.22
|
||||
*/
|
||||
protected final Log getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the specified message.
|
||||
* @param logger the logger
|
||||
* @param message the message
|
||||
* @param ex the exception
|
||||
* Get the {@code logStackTraces} flag for this {@code LoggingCacheErrorHandler}.
|
||||
* @return {@code true} if this {@code LoggingCacheErrorHandler} logs stack traces
|
||||
* @since 5.3.22
|
||||
*/
|
||||
protected void logCacheError(Log logger, String message, RuntimeException ex) {
|
||||
if (this.logStacktrace) {
|
||||
logger.warn(message, ex);
|
||||
}
|
||||
else {
|
||||
logger.warn(message);
|
||||
}
|
||||
protected final boolean isLogStackTraces() {
|
||||
return this.logStackTraces;
|
||||
}
|
||||
|
||||
private String createMessage(Cache cache, String reason) {
|
||||
return String.format("Cache '%s' %s", cache.getName(), reason);
|
||||
/**
|
||||
* Log the cache error message in the given supplier.
|
||||
* <p>If {@link #isLogStackTraces()} is {@code true}, the given
|
||||
* {@code exception} will be logged as well.
|
||||
* <p>The default implementation logs the message as a warning.
|
||||
* @param messageSupplier the message supplier
|
||||
* @param exception the exception thrown by the cache provider
|
||||
* @since 5.3.22
|
||||
* @see #isLogStackTraces()
|
||||
* @see #getLogger()
|
||||
*/
|
||||
protected void logCacheError(Supplier<String> messageSupplier, RuntimeException exception) {
|
||||
if (getLogger().isWarnEnabled()) {
|
||||
if (isLogStackTraces()) {
|
||||
getLogger().warn(messageSupplier.get(), exception);
|
||||
}
|
||||
else {
|
||||
getLogger().warn(messageSupplier.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* <p>Transparently replaces given {@code null} user values with an internal
|
||||
* {@link NullValue#INSTANCE}, if configured to support {@code null} values
|
||||
* (as indicated by {@link #isAllowNullValues()}.
|
||||
* (as indicated by {@link #isAllowNullValues()}).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.2.2
|
||||
|
||||
@@ -94,7 +94,7 @@ public interface ApplicationContext extends EnvironmentCapable, ListableBeanFact
|
||||
/**
|
||||
* Expose AutowireCapableBeanFactory functionality for this context.
|
||||
* <p>This is not typically used by application code, except for the purpose of
|
||||
* initializing bean instances that live outside of the application context,
|
||||
* initializing bean instances that live outside the application context,
|
||||
* applying the Spring bean lifecycle (fully or partly) to them.
|
||||
* <p>Alternatively, the internal BeanFactory exposed by the
|
||||
* {@link ConfigurableApplicationContext} interface offers access to the
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||
import org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase;
|
||||
import org.springframework.context.annotation.DeferredImportSelector.Group;
|
||||
import org.springframework.core.NestedIOException;
|
||||
import org.springframework.core.OrderComparator;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
@@ -680,6 +679,7 @@ class ConfigurationClassParser {
|
||||
/**
|
||||
* Factory method to obtain a {@link SourceClass} from a class name.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
SourceClass asSourceClass(@Nullable String className, Predicate<String> filter) throws IOException {
|
||||
if (className == null || filter.test(className)) {
|
||||
return this.objectSourceClass;
|
||||
@@ -690,7 +690,7 @@ class ConfigurationClassParser {
|
||||
return new SourceClass(ClassUtils.forName(className, this.resourceLoader.getClassLoader()));
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
throw new NestedIOException("Failed to load class [" + className + "]", ex);
|
||||
throw new org.springframework.core.NestedIOException("Failed to load class [" + className + "]", ex);
|
||||
}
|
||||
}
|
||||
return new SourceClass(this.metadataReaderFactory.getMetadataReader(className));
|
||||
@@ -1073,6 +1073,7 @@ class ConfigurationClassParser {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private SourceClass getRelated(String className) throws IOException {
|
||||
if (this.source instanceof Class) {
|
||||
try {
|
||||
@@ -1082,7 +1083,7 @@ class ConfigurationClassParser {
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Ignore -> fall back to ASM next, except for core java types.
|
||||
if (className.startsWith("java")) {
|
||||
throw new NestedIOException("Failed to load class [" + className + "]", ex);
|
||||
throw new org.springframework.core.NestedIOException("Failed to load class [" + className + "]", ex);
|
||||
}
|
||||
return new SourceClass(metadataReaderFactory.getMetadataReader(className));
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.springframework.jmx.support.RegistrationPolicy;
|
||||
|
||||
/**
|
||||
* Enables default exporting of all standard {@code MBean}s from the Spring context, as
|
||||
* well as well all {@code @ManagedResource} annotated beans.
|
||||
* well as all {@code @ManagedResource} annotated beans.
|
||||
*
|
||||
* <p>The resulting {@link org.springframework.jmx.export.MBeanExporter MBeanExporter}
|
||||
* bean is defined under the name "mbeanExporter". Alternatively, consider defining a
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
||||
* <p>If Role is present on a {@link Configuration @Configuration} class,
|
||||
* this indicates the role of the configuration class bean definition and
|
||||
* does not cascade to all @{@code Bean} methods defined within. This behavior
|
||||
* is different than that of the @{@link Lazy} annotation, for example.
|
||||
* is different from the behavior of the @{@link Lazy} annotation, for example.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
|
||||
+1
-1
@@ -295,7 +295,7 @@ public final class LocaleContextHolder {
|
||||
* <p>Note: This method has a fallback to the shared default TimeZone,
|
||||
* either at the framework level or at the JVM-wide system level.
|
||||
* If you'd like to check for the raw LocaleContext content
|
||||
* (which may indicate no specific time zone through {@code null}, use
|
||||
* (which may indicate no specific time zone through {@code null}), use
|
||||
* {@link #getLocaleContext()} and call {@link TimeZoneAwareLocaleContext#getTimeZone()}
|
||||
* after downcasting to {@link TimeZoneAwareLocaleContext}.
|
||||
* @return the current TimeZone, or the system default TimeZone if no
|
||||
|
||||
+17
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ProtocolResolver;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
@@ -86,6 +87,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Sam Brannen
|
||||
* @since 1.1.2
|
||||
* @see #registerBeanDefinition
|
||||
* @see #refresh()
|
||||
@@ -216,13 +218,23 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This implementation delegates to this context's ResourceLoader if set,
|
||||
* falling back to the default superclass behavior else.
|
||||
* @see #setResourceLoader
|
||||
* This implementation delegates to this context's {@code ResourceLoader} if set,
|
||||
* falling back to the default superclass behavior otherwise.
|
||||
* <p>As of Spring Framework 5.3.22, this method also honors registered
|
||||
* {@linkplain #getProtocolResolvers() protocol resolvers} when a custom
|
||||
* {@code ResourceLoader} has been set.
|
||||
* @see #setResourceLoader(ResourceLoader)
|
||||
* @see #addProtocolResolver(ProtocolResolver)
|
||||
*/
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
if (this.resourceLoader != null) {
|
||||
for (ProtocolResolver protocolResolver : getProtocolResolvers()) {
|
||||
Resource resource = protocolResolver.resolve(location, this);
|
||||
if (resource != null) {
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
return this.resourceLoader.getResource(location);
|
||||
}
|
||||
return super.getResource(location);
|
||||
@@ -231,7 +243,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
||||
/**
|
||||
* This implementation delegates to this context's ResourceLoader if it
|
||||
* implements the ResourcePatternResolver interface, falling back to the
|
||||
* default superclass behavior else.
|
||||
* default superclass behavior otherwise.
|
||||
* @see #setResourceLoader
|
||||
*/
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ import org.springframework.util.StringUtils;
|
||||
* "WEB-INF/messages_en.xml" etc. Note that message definitions in a <i>previous</i>
|
||||
* resource bundle will override ones in a later bundle, due to sequential lookup.
|
||||
|
||||
* <p>This MessageSource can easily be used outside of an
|
||||
* <p>This MessageSource can easily be used outside an
|
||||
* {@link org.springframework.context.ApplicationContext}: it will use a
|
||||
* {@link org.springframework.core.io.DefaultResourceLoader} as default,
|
||||
* simply getting overridden with the ApplicationContext's resource loader
|
||||
@@ -156,7 +156,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
* <p>The default is a DefaultResourceLoader. Will get overridden by the
|
||||
* ApplicationContext if running in a context, as it implements the
|
||||
* ResourceLoaderAware interface. Can be manually overridden when
|
||||
* running outside of an ApplicationContext.
|
||||
* running outside an ApplicationContext.
|
||||
* @see org.springframework.core.io.DefaultResourceLoader
|
||||
* @see org.springframework.context.ResourceLoaderAware
|
||||
*/
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
|
||||
}
|
||||
|
||||
/*
|
||||
* This method never fails, allowing to try other possible ways to use an
|
||||
* This method never fails, allowing to try other possible ways to use a
|
||||
* server-agnostic weaver. This non-failure logic is required since
|
||||
* determining a load-time weaver based on the ClassLoader name alone may
|
||||
* legitimately fail due to other mismatches.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user