类org.springframework.beans.factory.parsing.ProblemReporter源码实例Demo

下面列出了怎么用org.springframework.beans.factory.parsing.ProblemReporter的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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);
}
 
源代码2 项目: spring-analysis-note   文件: BeanMethod.java
@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());
		}
	}
}
 
源代码3 项目: spring-analysis-note   文件: ConfigurationClass.java
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);
		}
	}
}
 
源代码4 项目: spring-analysis-note   文件: XmlReaderContext.java
/**
 * 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;
}
 
/**
 * 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);
}
 
源代码6 项目: java-technology-stack   文件: BeanMethod.java
@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());
		}
	}
}
 
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);
	}
}
 
源代码8 项目: java-technology-stack   文件: XmlReaderContext.java
/**
 * 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;
}
 
源代码9 项目: lams   文件: ConfigurationClassParser.java
/**
 * 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);
}
 
源代码10 项目: lams   文件: BeanMethod.java
@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());
		}
	}
}
 
源代码11 项目: lams   文件: ConfigurationClass.java
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);
	}
}
 
源代码12 项目: lams   文件: XmlReaderContext.java
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;
}
 
源代码13 项目: blog_demos   文件: XmlReaderContext.java
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;
}
 
/**
 * 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);
}
 
源代码15 项目: spring4-understanding   文件: BeanMethod.java
@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());
		}
	}
}
 
源代码16 项目: spring4-understanding   文件: ConfigurationClass.java
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);
	}
}
 
源代码17 项目: spring4-understanding   文件: XmlReaderContext.java
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;
}
 
源代码18 项目: spring-analysis-note   文件: ConfigurationMethod.java
public void validate(ProblemReporter problemReporter) {
}
 
public void validate(ProblemReporter problemReporter) {
}
 
源代码20 项目: lams   文件: ConfigurationMethod.java
public void validate(ProblemReporter problemReporter) {
}
 
public void validate(ProblemReporter problemReporter) {
}
 
/**
 * 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());
}
 
/**
 * 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());
}
 
/**
 * 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());
}
 
/**
 * 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());
}
 
源代码26 项目: lams   文件: ConfigurationClassPostProcessor.java
/**
 * 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());
}
 
源代码27 项目: lams   文件: XmlBeanDefinitionReader.java
/**
 * 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());
}
 
源代码28 项目: blog_demos   文件: XmlBeanDefinitionReader.java
/**
 * 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());
}
 
/**
 * 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());
}
 
/**
 * 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());
}
 
 类方法
 同包方法