Merge branch '2.7.x'
This commit is contained in:
commit
fe8d8f4ed3
|
|
@ -168,7 +168,7 @@ class TypeElementMembers {
|
|||
}
|
||||
|
||||
private String getAccessorName(String methodName) {
|
||||
if (this.isRecord) {
|
||||
if (this.isRecord && this.fields.containsKey(methodName)) {
|
||||
return methodName;
|
||||
}
|
||||
String name;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
import org.springframework.boot.configurationsample.record.RecordWithGetter;
|
||||
import org.springframework.boot.configurationsample.recursive.RecursiveProperties;
|
||||
import org.springframework.boot.configurationsample.simple.ClassWithNestedProperties;
|
||||
import org.springframework.boot.configurationsample.simple.DeprecatedFieldSingleProperty;
|
||||
|
|
@ -71,6 +72,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|||
* @author Jonas Keßler
|
||||
* @author Pavel Anisimov
|
||||
* @author Scott Frederick
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
|
|
@ -476,4 +478,11 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
|
|||
assertThat(metadata).doesNotHave(Metadata.withProperty("config.nested.ignored"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void recordWithGetter() {
|
||||
ConfigurationMetadata metadata = compile(RecordWithGetter.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("record-with-getter.alpha"));
|
||||
assertThat(metadata).doesNotHave(Metadata.withProperty("record-with-getter.bravo"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2012-2023 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.configurationsample.record;
|
||||
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
@ConfigurationProperties("record-with-getter")
|
||||
public record RecordWithGetter(String alpha) {
|
||||
|
||||
public String getBravo() {
|
||||
return this.alpha;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue