<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="http://www.grails.org/schema/context" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:beans="http://www.springframework.org/schema/beans"
			xmlns:tool="http://www.springframework.org/schema/tool"
			targetNamespace="http://www.grails.org/schema/context" elementFormDefault="qualified"
			attributeFormDefault="unqualified">

	<xsd:import namespace="http://www.springframework.org/schema/beans"/>
	<xsd:import namespace="http://www.springframework.org/schema/tool"/>


	<xsd:element name="component-scan">
		<xsd:annotation>
			<xsd:documentation><![CDATA[
	Scans the classpath for annotated components that will be auto-registered as
	Spring beans. By default, the Spring-provided @Component, @Repository,
	@Service, and @Controller stereotypes will be detected.

	Note: This tag implies the effects of the 'annotation-config' tag, activating @Required,
	@Autowired, @PostConstruct, @PreDestroy, @Resource, @PersistenceContext and @PersistenceUnit
	annotations in the component classes, which is usually desired for autodetected components
	(without external configuration). Turn off the 'annotation-config' attribute to deactivate
	this default behavior, for example in order to use custom BeanPostProcessor definitions
	for handling those annotations.

	Note: You may use placeholders in package paths, but only resolved against system
	properties (analogous to resource paths). A component scan results in new bean definition
	being registered; Spring's PropertyPlaceholderConfigurer will apply to those bean
	definitions just like to regular bean definitions, but it won't apply to the component
	scan settings themselves.
			]]></xsd:documentation>

		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="include-filter" type="filterType" minOccurs="0" maxOccurs="unbounded">
					<xsd:annotation>
						<xsd:documentation><![CDATA[
	Controls which eligible types to include for component scanning.
							]]></xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="exclude-filter" type="filterType" minOccurs="0" maxOccurs="unbounded">

					<xsd:annotation>
						<xsd:documentation><![CDATA[
	Controls which eligible types to exclude for component scanning.
						]]></xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:sequence>
			<xsd:attribute name="base-package" type="xsd:string" use="required">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	The comma-separated list of packages to scan for annotated components.
					]]></xsd:documentation>
				</xsd:annotation>

			</xsd:attribute>
			<xsd:attribute name="resource-pattern" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	Controls the class files eligible for component detection. Defaults to "**/*.class", the recommended value.
					]]></xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="use-default-filters" type="xsd:boolean" default="true">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	Indicates whether automatic detection of classes annotated with @Component, @Repository, @Service, or @Controller
	should be enabled. Default is "true".
					]]></xsd:documentation>

				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="annotation-config" type="xsd:boolean" default="true">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	Indicates whether the implicit AutowiredAnnotationBeanPostProcessor and CommonAnnotationBeanPostProcessor should
	 be enabled. Default is "true".
					]]></xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="name-generator" type="xsd:string">
				<xsd:annotation>

					<xsd:documentation><![CDATA[
	The fully-qualified classname of the BeanNameGenerator to be used for naming detected components.
					]]></xsd:documentation>
					<xsd:appinfo>
						<tool:annotation>
							<tool:expected-type type="java.lang.Class"/>
							<tool:assignable-to type="org.springframework.beans.factory.support.BeanNameGenerator"/>
						</tool:annotation>
					</xsd:appinfo>
				</xsd:annotation>
			</xsd:attribute>

			<xsd:attribute name="scope-resolver" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	The fully-qualified class name of the ScopeMetadataResolver to be used for resolving the scope of detected components.
					]]></xsd:documentation>
					<xsd:appinfo>
						<tool:annotation>
							<tool:expected-type type="java.lang.Class"/>
							<tool:assignable-to type="org.springframework.context.annotation.ScopeMetadataResolver"/>
						</tool:annotation>
					</xsd:appinfo>

				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="scoped-proxy">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
	Indicates whether proxies should be generated for detected components, which may be necessary when using certain
	non-singleton scopes in a proxy-style fashion. Default is to generate no such proxies.
					]]></xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="no"/>

						<xsd:enumeration value="interfaces"/>
						<xsd:enumeration value="targetClass"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="filterType">
		<xsd:attribute name="type" use="required">
			<xsd:annotation>
				<xsd:documentation><![CDATA[
    Controls the type of filtering to apply to the expression.

    "annotation" indicates an annotation to be present at the type level in target components;
    "assignable" indicates a class (or interface) that the target components are assignable to (extend/implement);
    "aspectj" indicates an AspectJ type expression to be matched by the target components;
    "regex" indicates a regex expression to be matched by the target components' class names;
    "custom" indicates a custom implementation of the org.springframework.core.type.TypeFilter interface.

    Note: This attribute will not be inherited by child bean definitions.
    Hence, it needs to be specified per concrete bean definition.
                ]]></xsd:documentation>
			</xsd:annotation>
			<xsd:simpleType>

				<xsd:restriction base="xsd:string">
					<xsd:enumeration value="annotation"/>
					<xsd:enumeration value="assignable"/>
					<xsd:enumeration value="aspectj"/>
					<xsd:enumeration value="regex"/>
					<xsd:enumeration value="custom"/>
				</xsd:restriction>
			</xsd:simpleType>
		</xsd:attribute>

		<xsd:attribute name="expression" type="xsd:string" use="required">
			<xsd:annotation>
				<xsd:documentation><![CDATA[
    Indicates the filter expression, the type of which is indicated by "type".
                ]]></xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
	</xsd:complexType>

</xsd:schema>
