Skip to content

Metadata reading during configuration class parsing uses the default resource loader rather than the application's resource loader #39321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
uses: actions/checkout@v4

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2

- name: Set up Gradle
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2
uses: gradle/gradle-build-action@3b1b3b9a2104c2b47fbae53f3938079c00c9bb87

- name: Build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2
2 changes: 1 addition & 1 deletion ci/images/ci-image-jdk21/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG DOCKER_PROXY_CACHE=
FROM ${DOCKER_PROXY_CACHE}ubuntu:jammy-20240111
FROM ${DOCKER_PROXY_CACHE}ubuntu:jammy-20240125

ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
Expand Down
2 changes: 1 addition & 1 deletion ci/images/ci-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG DOCKER_PROXY_CACHE=
FROM ${DOCKER_PROXY_CACHE}ubuntu:jammy-20240111
FROM ${DOCKER_PROXY_CACHE}ubuntu:jammy-20240125

ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
Expand Down
2 changes: 1 addition & 1 deletion ci/images/get-docker-url.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e

version="25.0.1"
version="25.0.3"
echo "https://download.docker.com/linux/static/stable/x86_64/docker-$version.tgz";
4 changes: 2 additions & 2 deletions ci/scripts/detect-docker-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ if [[ $latest_version =~ (beta|rc) ]]; then
fi

title_prefix="Upgrade CI to Docker"
milestone_number=$( curl -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/milestones\?state\=open | jq -c --arg MILESTONE "$MILESTONE" '.[] | select(.title==$MILESTONE)' | jq -r '.number')
existing_upgrade_issues=$( curl -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues\?labels\=type:%20task\&state\=open\&creator\=spring-builds\&milestone\=${milestone_number} | jq -c --arg TITLE_PREFIX "$title_prefix" '.[] | select(.title | startswith($TITLE_PREFIX))' )
milestone_number=$( curl -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/milestones\?state\=open | jq -c --arg MILESTONE "$MILESTONE" '.[] | select(.title==$MILESTONE)' | jq -r '.number')
existing_upgrade_issues=$( curl -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues\?labels\=type:%20task\&state\=open\&creator\=spring-builds\&milestone\=${milestone_number} | jq -c --arg TITLE_PREFIX "$title_prefix" '.[] | select(.title | startswith($TITLE_PREFIX))' )

latest="https://download.docker.com/linux/static/stable/x86_64/docker-$latest_version.tgz"
current=$( git-repo/ci/images/get-docker-url.sh )
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
version=3.3.0-SNAPSHOT
version=3.1.9-SNAPSHOT

org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8

assertjVersion=3.25.1
commonsCodecVersion=1.16.0
assertjVersion=3.24.2
commonsCodecVersion=1.15
hamcrestVersion=2.2
jacksonVersion=2.16.1
junitJupiterVersion=5.10.1
kotlinVersion=1.9.22
jacksonVersion=2.15.3
junitJupiterVersion=5.9.3
kotlinVersion=1.8.22
mavenVersion=3.9.4
nativeBuildToolsVersion=0.9.28
springFrameworkVersion=6.1.3
springFrameworkVersion=6.0.17-SNAPSHOT
tomcatVersion=10.1.18

kotlin.stdlib.default.dependency=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand Down Expand Up @@ -81,6 +81,7 @@ private void customizeSameAsParentContext(T factory) {
customizers.add(BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory, customizerClass));
}
catch (NoSuchBeanDefinitionException ex) {
// Ignore
}
}
invokeCustomizers(factory, customizers);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -18,8 +18,8 @@

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -56,7 +56,7 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation
void allAuditEvents() throws Exception {
String queryTimestamp = "2017-11-07T09:37Z";
given(this.repository.find(any(), any(), any()))
.willReturn(Arrays.asList(new AuditEvent("alice", "logout", Collections.emptyMap())));
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
this.mockMvc.perform(get("/actuator/auditevents").param("after", queryTimestamp))
.andExpect(status().isOk())
.andDo(document("auditevents/all",
Expand All @@ -72,7 +72,7 @@ void filteredAuditEvents() throws Exception {
OffsetDateTime now = OffsetDateTime.now();
String queryTimestamp = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now);
given(this.repository.find("alice", now.toInstant(), "logout"))
.willReturn(Arrays.asList(new AuditEvent("alice", "logout", Collections.emptyMap())));
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
this.mockMvc
.perform(get("/actuator/auditevents").param("principal", "alice")
.param("after", queryTimestamp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -16,7 +16,6 @@

package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -50,7 +49,7 @@ class BeansEndpointDocumentationTests extends MockMvcEndpointDocumentationTests

@Test
void beans() throws Exception {
List<FieldDescriptor> beanFields = Arrays.asList(fieldWithPath("aliases").description("Names of any aliases."),
List<FieldDescriptor> beanFields = List.of(fieldWithPath("aliases").description("Names of any aliases."),
fieldWithPath("scope").description("Scope of the bean."),
fieldWithPath("type").description("Fully qualified type of the bean."),
fieldWithPath("resource").description("Resource in which the bean was defined, if any.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -16,7 +16,6 @@

package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -50,8 +49,7 @@
*/
class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {

private static final List<FieldDescriptor> levelFields = Arrays.asList(
fieldWithPath("name").description("Cache name."),
private static final List<FieldDescriptor> levelFields = List.of(fieldWithPath("name").description("Cache name."),
fieldWithPath("cacheManager").description("Cache manager name."),
fieldWithPath("target").description("Fully qualified name of the native cache."));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -16,27 +16,20 @@

package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;

import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.restdocs.RestDocumentationContextProvider;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.restdocs.payload.JsonFieldType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
Expand All @@ -51,26 +44,13 @@
*/
class ConditionsReportEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {

private MockMvc mockMvc;

@Autowired
private WebApplicationContext applicationContext;

@Override
@BeforeEach
void setup(RestDocumentationContextProvider restDocumentation) {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext)
.apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris())
.build();
}

@Test
void conditions() throws Exception {
List<FieldDescriptor> positiveMatchFields = Arrays.asList(
List<FieldDescriptor> positiveMatchFields = List.of(
fieldWithPath("").description("Classes and methods with conditions that were matched."),
fieldWithPath(".*.[].condition").description("Name of the condition."),
fieldWithPath(".*.[].message").description("Details of why the condition was matched."));
List<FieldDescriptor> negativeMatchFields = Arrays.asList(
List<FieldDescriptor> negativeMatchFields = List.of(
fieldWithPath("").description("Classes and methods with conditions that were not matched."),
fieldWithPath(".*.notMatched").description("Conditions that were matched."),
fieldWithPath(".*.notMatched.[].condition").description("Name of the condition."),
Expand Down Expand Up @@ -104,7 +84,7 @@ ConditionsReportEndpoint autoConfigurationReportEndpoint(ConfigurableApplication
ConditionEvaluationReport conditionEvaluationReport = ConditionEvaluationReport
.get(context.getBeanFactory());
conditionEvaluationReport
.recordEvaluationCandidates(Arrays.asList(PropertyPlaceholderAutoConfiguration.class.getName()));
.recordEvaluationCandidates(List.of(PropertyPlaceholderAutoConfiguration.class.getName()));
return new ConditionsReportEndpoint(context);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand All @@ -16,7 +16,6 @@

package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;

import java.util.Arrays;
import java.util.List;

import javax.sql.DataSource;
Expand Down Expand Up @@ -61,7 +60,7 @@ void flyway() throws Exception {
}

private List<FieldDescriptor> migrationFieldDescriptors() {
return Arrays.asList(fieldWithPath("checksum").description("Checksum of the migration, if any.").optional(),
return List.of(fieldWithPath("checksum").description("Checksum of the migration, if any.").optional(),
fieldWithPath("description").description("Description of the migration, if any.").optional(),
fieldWithPath("executionTime").description("Execution time in milliseconds of an applied migration.")
.optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;

import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -68,7 +67,7 @@
*/
class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {

private static final List<FieldDescriptor> componentFields = Arrays.asList(
private static final List<FieldDescriptor> componentFields = List.of(
fieldWithPath("status").description("Status of a specific part of the application"),
subsectionWithPath("details").description("Details of the health of a specific part of the application."));

Expand Down
Loading