<context:annotation-config />Первый подход — объявить элемент <context:annotation-config /> в своём XML-файле конфигурации. Это автоматически регистрирует бин RequiredAnnotationBeanPostProcessor.
Шаги:
<context:annotation-config />Пример:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
</beans>
Второй подход — явно объявить RequiredAnnotationBeanPostProcessor как бин в файле конфигурации.
Пример:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" />
</beans>
@RequiredЭлемент <context:annotation-config /> требует объявления пространства имён context в XML-конфигурации перед его использованием.
Новый — ещё не проверен сообществом
Вы