org.springframework.beans.factory.parsing.ProblemReporter Java Examples

The following examples show how to use org.springframework.beans.factory.parsing.ProblemReporter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlReaderContext.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Construct a new {@code XmlReaderContext}.
 * @param resource the XML bean definition resource
 * @param problemReporter the problem reporter in use
 * @param eventListener the event listener in use
 * @param sourceExtractor the source extractor in use
 * @param reader the XML bean definition reader in use
 * @param namespaceHandlerResolver the XML namespace resolver
 */
public XmlReaderContext(
		Resource resource, ProblemReporter problemReporter,
		ReaderEventListener eventListener, SourceExtractor sourceExtractor,
		XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

	super(resource, problemReporter, eventListener, sourceExtractor);
	this.reader = reader;
	this.namespaceHandlerResolver = namespaceHandlerResolver;
}
 
Example #2
Source File: ConfigurationClassParser.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link ConfigurationClassParser} instance that will be used
 * to populate the set of configuration classes.
 */
public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory,
		ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader,
		BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {

	this.metadataReaderFactory = metadataReaderFactory;
	this.problemReporter = problemReporter;
	this.environment = environment;
	this.resourceLoader = resourceLoader;
	this.registry = registry;
	this.componentScanParser = new ComponentScanAnnotationParser(
			resourceLoader, environment, componentScanBeanNameGenerator, registry);
	this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}
 
Example #3
Source File: XmlReaderContext.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
public XmlReaderContext(
		Resource resource, ProblemReporter problemReporter,
		ReaderEventListener eventListener, SourceExtractor sourceExtractor,
		XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

	super(resource, problemReporter, eventListener, sourceExtractor);
	this.reader = reader;
	this.namespaceHandlerResolver = namespaceHandlerResolver;
}
 
Example #4
Source File: XmlReaderContext.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public XmlReaderContext(
		Resource resource, ProblemReporter problemReporter,
		ReaderEventListener eventListener, SourceExtractor sourceExtractor,
		XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

	super(resource, problemReporter, eventListener, sourceExtractor);
	this.reader = reader;
	this.namespaceHandlerResolver = namespaceHandlerResolver;
}
 
Example #5
Source File: ConfigurationClass.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
	// A configuration class may not be final (CGLIB limitation)
	if (getMetadata().isAnnotated(Configuration.class.getName())) {
		if (getMetadata().isFinal()) {
			problemReporter.error(new FinalConfigurationProblem());
		}
	}

	for (BeanMethod beanMethod : this.beanMethods) {
		beanMethod.validate(problemReporter);
	}
}
 
Example #6
Source File: BeanMethod.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void validate(ProblemReporter problemReporter) {
	if (getMetadata().isStatic()) {
		// static @Bean methods have no constraints to validate -> return immediately
		return;
	}

	if (this.configurationClass.getMetadata().isAnnotated(Configuration.class.getName())) {
		if (!getMetadata().isOverridable()) {
			// instance @Bean methods within @Configuration classes must be overridable to accommodate CGLIB
			problemReporter.error(new NonOverridableMethodError());
		}
	}
}
 
Example #7
Source File: ConfigurationClassParser.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a new {@link ConfigurationClassParser} instance that will be used
 * to populate the set of configuration classes.
 */
public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory,
		ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader,
		BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {

	this.metadataReaderFactory = metadataReaderFactory;
	this.problemReporter = problemReporter;
	this.environment = environment;
	this.resourceLoader = resourceLoader;
	this.registry = registry;
	this.componentScanParser = new ComponentScanAnnotationParser(
			environment, resourceLoader, componentScanBeanNameGenerator, registry);
	this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}
 
Example #8
Source File: ConfigurationClassParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new {@link ConfigurationClassParser} instance that will be used
 * to populate the set of configuration classes.
 */
public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory,
		ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader,
		BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {

	this.metadataReaderFactory = metadataReaderFactory;
	this.problemReporter = problemReporter;
	this.environment = environment;
	this.resourceLoader = resourceLoader;
	this.registry = registry;
	this.componentScanParser = new ComponentScanAnnotationParser(
			environment, resourceLoader, componentScanBeanNameGenerator, registry);
	this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}
 
Example #9
Source File: BeanMethod.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void validate(ProblemReporter problemReporter) {
	if (getMetadata().isStatic()) {
		// static @Bean methods have no constraints to validate -> return immediately
		return;
	}

	if (this.configurationClass.getMetadata().isAnnotated(Configuration.class.getName())) {
		if (!getMetadata().isOverridable()) {
			// instance @Bean methods within @Configuration classes must be overridable to accommodate CGLIB
			problemReporter.error(new NonOverridableMethodError());
		}
	}
}
 
Example #10
Source File: ConfigurationClass.java    From java-technology-stack with MIT License 5 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
	// A configuration class may not be final (CGLIB limitation)
	if (getMetadata().isAnnotated(Configuration.class.getName())) {
		if (getMetadata().isFinal()) {
			problemReporter.error(new FinalConfigurationProblem());
		}
	}

	for (BeanMethod beanMethod : this.beanMethods) {
		beanMethod.validate(problemReporter);
	}
}
 
Example #11
Source File: BeanMethod.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void validate(ProblemReporter problemReporter) {
	if (getMetadata().isStatic()) {
		// static @Bean methods have no constraints to validate -> return immediately
		return;
	}

	if (this.configurationClass.getMetadata().isAnnotated(Configuration.class.getName())) {
		if (!getMetadata().isOverridable()) {
			// instance @Bean methods within @Configuration classes must be overridable to accommodate CGLIB
			problemReporter.error(new NonOverridableMethodError());
		}
	}
}
 
Example #12
Source File: ConfigurationClass.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
	// A configuration class may not be final (CGLIB limitation)
	if (getMetadata().isAnnotated(Configuration.class.getName())) {
		if (getMetadata().isFinal()) {
			problemReporter.error(new FinalConfigurationProblem());
		}
	}

	for (BeanMethod beanMethod : this.beanMethods) {
		beanMethod.validate(problemReporter);
	}
}
 
Example #13
Source File: ConfigurationClassParser.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a new {@link ConfigurationClassParser} instance that will be used
 * to populate the set of configuration classes.
 */
public ConfigurationClassParser(MetadataReaderFactory metadataReaderFactory,
		ProblemReporter problemReporter, Environment environment, ResourceLoader resourceLoader,
		BeanNameGenerator componentScanBeanNameGenerator, BeanDefinitionRegistry registry) {

	this.metadataReaderFactory = metadataReaderFactory;
	this.problemReporter = problemReporter;
	this.environment = environment;
	this.resourceLoader = resourceLoader;
	this.registry = registry;
	this.componentScanParser = new ComponentScanAnnotationParser(
			environment, resourceLoader, componentScanBeanNameGenerator, registry);
	this.conditionEvaluator = new ConditionEvaluator(registry, environment, resourceLoader);
}
 
Example #14
Source File: XmlReaderContext.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public XmlReaderContext(
		Resource resource, ProblemReporter problemReporter,
		ReaderEventListener eventListener, SourceExtractor sourceExtractor,
		XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

	super(resource, problemReporter, eventListener, sourceExtractor);
	this.reader = reader;
	this.namespaceHandlerResolver = namespaceHandlerResolver;
}
 
Example #15
Source File: XmlReaderContext.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Construct a new {@code XmlReaderContext}.
 * @param resource the XML bean definition resource
 * @param problemReporter the problem reporter in use
 * @param eventListener the event listener in use
 * @param sourceExtractor the source extractor in use
 * @param reader the XML bean definition reader in use
 * @param namespaceHandlerResolver the XML namespace resolver
 */
public XmlReaderContext(
		Resource resource, ProblemReporter problemReporter,
		ReaderEventListener eventListener, SourceExtractor sourceExtractor,
		XmlBeanDefinitionReader reader, NamespaceHandlerResolver namespaceHandlerResolver) {

	super(resource, problemReporter, eventListener, sourceExtractor);
	this.reader = reader;
	this.namespaceHandlerResolver = namespaceHandlerResolver;
}
 
Example #16
Source File: ConfigurationClass.java    From spring-analysis-note with MIT License 5 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
	// A configuration class may not be final (CGLIB limitation) unless it declares proxyBeanMethods=false
	Map<String, Object> attributes = this.metadata.getAnnotationAttributes(Configuration.class.getName());
	if (attributes != null && (Boolean) attributes.get("proxyBeanMethods")) {
		if (this.metadata.isFinal()) {
			problemReporter.error(new FinalConfigurationProblem());
		}
		for (BeanMethod beanMethod : this.beanMethods) {
			beanMethod.validate(problemReporter);
		}
	}
}
 
Example #17
Source File: BeanMethod.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void validate(ProblemReporter problemReporter) {
	if (getMetadata().isStatic()) {
		// static @Bean methods have no constraints to validate -> return immediately
		return;
	}

	if (this.configurationClass.getMetadata().isAnnotated(Configuration.class.getName())) {
		if (!getMetadata().isOverridable()) {
			// instance @Bean methods within @Configuration classes must be overridable to accommodate CGLIB
			problemReporter.error(new NonOverridableMethodError());
		}
	}
}
 
Example #18
Source File: ConfigurationMethod.java    From java-technology-stack with MIT License 4 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
}
 
Example #19
Source File: ConfigurationMethod.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
}
 
Example #20
Source File: ConfigurationMethod.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
}
 
Example #21
Source File: ConfigurationMethod.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public void validate(ProblemReporter problemReporter) {
}
 
Example #22
Source File: ConfigurationClassPostProcessor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set the {@link ProblemReporter} to use.
 * <p>Used to register any problems detected with {@link Configuration} or {@link Bean}
 * declarations. For instance, an @Bean method marked as {@code final} is illegal
 * and would be reported as a problem. Defaults to {@link FailFastProblemReporter}.
 */
public void setProblemReporter(ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #23
Source File: ConfigurationClassPostProcessor.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set the {@link ProblemReporter} to use.
 * <p>Used to register any problems detected with {@link Configuration} or {@link Bean}
 * declarations. For instance, an @Bean method marked as {@code final} is illegal
 * and would be reported as a problem. Defaults to {@link FailFastProblemReporter}.
 */
public void setProblemReporter(ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #24
Source File: XmlBeanDefinitionReader.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
 * <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
 * which exhibits fail fast behaviour. External tools can provide an alternative implementation
 * that collates errors and warnings for display in the tool UI.
 */
public void setProblemReporter(ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #25
Source File: XmlBeanDefinitionReader.java    From blog_demos with Apache License 2.0 2 votes vote down vote up
/**
 * Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
 * <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
 * which exhibits fail fast behaviour. External tools can provide an alternative implementation
 * that collates errors and warnings for display in the tool UI.
 */
public void setProblemReporter(ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #26
Source File: XmlBeanDefinitionReader.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
 * <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
 * which exhibits fail fast behaviour. External tools can provide an alternative implementation
 * that collates errors and warnings for display in the tool UI.
 */
public void setProblemReporter(ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #27
Source File: XmlBeanDefinitionReader.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
 * <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
 * which exhibits fail fast behaviour. External tools can provide an alternative implementation
 * that collates errors and warnings for display in the tool UI.
 */
public void setProblemReporter(@Nullable ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #28
Source File: ConfigurationClassPostProcessor.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set the {@link ProblemReporter} to use.
 * <p>Used to register any problems detected with {@link Configuration} or {@link Bean}
 * declarations. For instance, an @Bean method marked as {@code final} is illegal
 * and would be reported as a problem. Defaults to {@link FailFastProblemReporter}.
 */
public void setProblemReporter(@Nullable ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #29
Source File: XmlBeanDefinitionReader.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Specify which {@link org.springframework.beans.factory.parsing.ProblemReporter} to use.
 * <p>The default implementation is {@link org.springframework.beans.factory.parsing.FailFastProblemReporter}
 * which exhibits fail fast behaviour. External tools can provide an alternative implementation
 * that collates errors and warnings for display in the tool UI.
 */
public void setProblemReporter(@Nullable ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}
 
Example #30
Source File: ConfigurationClassPostProcessor.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set the {@link ProblemReporter} to use.
 * <p>Used to register any problems detected with {@link Configuration} or {@link Bean}
 * declarations. For instance, an @Bean method marked as {@code final} is illegal
 * and would be reported as a problem. Defaults to {@link FailFastProblemReporter}.
 */
public void setProblemReporter(@Nullable ProblemReporter problemReporter) {
	this.problemReporter = (problemReporter != null ? problemReporter : new FailFastProblemReporter());
}