|
|
@ -36,15 +36,14 @@ import java.util.stream.Stream;
|
|
|
|
import ch.qos.logback.classic.joran.JoranConfigurator;
|
|
|
|
import ch.qos.logback.classic.joran.JoranConfigurator;
|
|
|
|
import ch.qos.logback.core.Context;
|
|
|
|
import ch.qos.logback.core.Context;
|
|
|
|
import ch.qos.logback.core.CoreConstants;
|
|
|
|
import ch.qos.logback.core.CoreConstants;
|
|
|
|
import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
|
|
|
|
|
|
|
|
import ch.qos.logback.core.joran.spi.ElementSelector;
|
|
|
|
import ch.qos.logback.core.joran.spi.ElementSelector;
|
|
|
|
import ch.qos.logback.core.joran.spi.RuleStore;
|
|
|
|
import ch.qos.logback.core.joran.spi.RuleStore;
|
|
|
|
import ch.qos.logback.core.joran.util.beans.BeanDescription;
|
|
|
|
import ch.qos.logback.core.joran.util.beans.BeanDescription;
|
|
|
|
import ch.qos.logback.core.joran.util.beans.BeanDescriptionCache;
|
|
|
|
|
|
|
|
import ch.qos.logback.core.model.ComponentModel;
|
|
|
|
import ch.qos.logback.core.model.ComponentModel;
|
|
|
|
import ch.qos.logback.core.model.Model;
|
|
|
|
import ch.qos.logback.core.model.Model;
|
|
|
|
import ch.qos.logback.core.model.ModelUtil;
|
|
|
|
import ch.qos.logback.core.model.ModelUtil;
|
|
|
|
import ch.qos.logback.core.model.processor.DefaultProcessor;
|
|
|
|
import ch.qos.logback.core.model.processor.DefaultProcessor;
|
|
|
|
|
|
|
|
import ch.qos.logback.core.model.processor.ModelInterpretationContext;
|
|
|
|
import ch.qos.logback.core.spi.ContextAware;
|
|
|
|
import ch.qos.logback.core.spi.ContextAware;
|
|
|
|
import ch.qos.logback.core.spi.ContextAwareBase;
|
|
|
|
import ch.qos.logback.core.spi.ContextAwareBase;
|
|
|
|
|
|
|
|
|
|
|
@ -113,9 +112,7 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|
|
|
super.processModel(model);
|
|
|
|
super.processModel(model);
|
|
|
|
if (!NativeDetector.inNativeImage() && isAotProcessingInProgress()) {
|
|
|
|
if (!NativeDetector.inNativeImage() && isAotProcessingInProgress()) {
|
|
|
|
getContext().putObject(BeanFactoryInitializationAotContribution.class.getName(),
|
|
|
|
getContext().putObject(BeanFactoryInitializationAotContribution.class.getName(),
|
|
|
|
new LogbackConfigurationAotContribution(model,
|
|
|
|
new LogbackConfigurationAotContribution(model, getModelInterpretationContext(), getContext()));
|
|
|
|
getModelInterpretationContext().getBeanDescriptionCache(),
|
|
|
|
|
|
|
|
getModelInterpretationContext().getDefaultNestedComponentRegistry(), getContext()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -129,9 +126,9 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|
|
|
|
|
|
|
|
|
|
|
private final PatternRules patternRules;
|
|
|
|
private final PatternRules patternRules;
|
|
|
|
|
|
|
|
|
|
|
|
private LogbackConfigurationAotContribution(Model model, BeanDescriptionCache beanDescriptionCache,
|
|
|
|
private LogbackConfigurationAotContribution(Model model, ModelInterpretationContext interpretationContext,
|
|
|
|
DefaultNestedComponentRegistry nestedComponentRegistry, Context context) {
|
|
|
|
Context context) {
|
|
|
|
this.modelWriter = new ModelWriter(model, beanDescriptionCache, nestedComponentRegistry);
|
|
|
|
this.modelWriter = new ModelWriter(model, interpretationContext);
|
|
|
|
this.patternRules = new PatternRules(context);
|
|
|
|
this.patternRules = new PatternRules(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -150,15 +147,11 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|
|
|
|
|
|
|
|
|
|
|
private final Model model;
|
|
|
|
private final Model model;
|
|
|
|
|
|
|
|
|
|
|
|
private final BeanDescriptionCache beanDescriptionCache;
|
|
|
|
private final ModelInterpretationContext modelInterpretationContext;
|
|
|
|
|
|
|
|
|
|
|
|
private final DefaultNestedComponentRegistry nestedComponentRegistry;
|
|
|
|
private ModelWriter(Model model, ModelInterpretationContext modelInterpretationContext) {
|
|
|
|
|
|
|
|
|
|
|
|
private ModelWriter(Model model, BeanDescriptionCache beanDescriptionCache,
|
|
|
|
|
|
|
|
DefaultNestedComponentRegistry nestedComponentRegistry) {
|
|
|
|
|
|
|
|
this.model = model;
|
|
|
|
this.model = model;
|
|
|
|
this.beanDescriptionCache = beanDescriptionCache;
|
|
|
|
this.modelInterpretationContext = modelInterpretationContext;
|
|
|
|
this.nestedComponentRegistry = nestedComponentRegistry;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void writeTo(GenerationContext generationContext) {
|
|
|
|
private void writeTo(GenerationContext generationContext) {
|
|
|
@ -215,7 +208,8 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String tag = model.getTag();
|
|
|
|
String tag = model.getTag();
|
|
|
|
if (tag != null) {
|
|
|
|
if (tag != null) {
|
|
|
|
String componentType = this.nestedComponentRegistry.findDefaultComponentTypeByTag(tag);
|
|
|
|
String componentType = this.modelInterpretationContext.getDefaultNestedComponentRegistry()
|
|
|
|
|
|
|
|
.findDefaultComponentTypeByTag(tag);
|
|
|
|
processComponent(componentType, reflectionTypes);
|
|
|
|
processComponent(componentType, reflectionTypes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Model submodel : model.getSubModels()) {
|
|
|
|
for (Model submodel : model.getSubModels()) {
|
|
|
@ -226,7 +220,8 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
|
|
|
|
|
|
|
|
|
|
|
private void processComponent(String componentTypeName, Set<String> reflectionTypes) {
|
|
|
|
private void processComponent(String componentTypeName, Set<String> reflectionTypes) {
|
|
|
|
if (componentTypeName != null) {
|
|
|
|
if (componentTypeName != null) {
|
|
|
|
BeanDescription beanDescription = this.beanDescriptionCache
|
|
|
|
componentTypeName = this.modelInterpretationContext.getImport(componentTypeName);
|
|
|
|
|
|
|
|
BeanDescription beanDescription = this.modelInterpretationContext.getBeanDescriptionCache()
|
|
|
|
.getBeanDescription(loadComponentType(componentTypeName));
|
|
|
|
.getBeanDescription(loadComponentType(componentTypeName));
|
|
|
|
reflectionTypes.addAll(parameterTypesNames(beanDescription.getPropertyNameToAdder().values()));
|
|
|
|
reflectionTypes.addAll(parameterTypesNames(beanDescription.getPropertyNameToAdder().values()));
|
|
|
|
reflectionTypes.addAll(parameterTypesNames(beanDescription.getPropertyNameToSetter().values()));
|
|
|
|
reflectionTypes.addAll(parameterTypesNames(beanDescription.getPropertyNameToSetter().values()));
|
|
|
|