Polishing
This commit is contained in:
@@ -138,6 +138,7 @@ class DefaultBeanRegistrationCodeFragments extends BeanRegistrationCodeFragments
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeBlock generateSetBeanInstanceSupplierCode(
|
||||
GenerationContext generationContext,
|
||||
BeanRegistrationCode beanRegistrationCode, CodeBlock instanceSupplierCode,
|
||||
|
||||
@@ -196,7 +196,7 @@ class BeanDefinitionMethodGeneratorTests {
|
||||
RootBeanDefinition beanDefinition,
|
||||
Predicate<String> attributeFilter) {
|
||||
return super.generateSetBeanDefinitionPropertiesCode(generationContext,
|
||||
beanRegistrationCode, beanDefinition, name -> "a".equals(name));
|
||||
beanRegistrationCode, beanDefinition, "a"::equals);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -371,7 +371,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
|
||||
void attributesWhenSomeFiltered() {
|
||||
this.beanDefinition.setAttribute("a", "A");
|
||||
this.beanDefinition.setAttribute("b", "B");
|
||||
Predicate<String> attributeFilter = attribute -> "a".equals(attribute);
|
||||
Predicate<String> attributeFilter = "a"::equals;
|
||||
this.generator = new BeanDefinitionPropertiesCodeGenerator(this.hints,
|
||||
attributeFilter, this.generatedMethods, (name, value) -> null);
|
||||
testCompiledResult(this.beanDefinition, (actual, compiled) -> {
|
||||
|
||||
@@ -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.
|
||||
@@ -38,7 +38,7 @@ public class DefaultSingletonBeanRegistryTests {
|
||||
beanRegistry.registerSingleton("tb", tb);
|
||||
assertThat(beanRegistry.getSingleton("tb")).isSameAs(tb);
|
||||
|
||||
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", () -> new TestBean());
|
||||
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", TestBean::new);
|
||||
assertThat(beanRegistry.getSingleton("tb2")).isSameAs(tb2);
|
||||
|
||||
assertThat(beanRegistry.getSingleton("tb")).isSameAs(tb);
|
||||
|
||||
Reference in New Issue
Block a user