The matching wildcard is strict, but no declaration can be found for element 'aop:config'
Подскажите, пожалуйста, в чем здесь ошибка и как исправить данную ситуацию?
Получаю такого вида Exception: Caused by: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 17; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
TaskService:
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("taskService")
public class TaskService {
public void performJob() {
log.info("Perform Job");
}
public void performExceptionJob() throws Exception {
log.info("Throws exception in Job");
throw new Exception("Exception JOB");
}
}
Work:
@Slf4j
@Component("work")
public class Work {
public void beforeWork() {
log.info("Execute before work");
}
public void afterWork() {
log.info("Execute after work");
}
public void afterWorkProblems() {
log.info("Execution problems");
}
}
App:
@Slf4j
public class App {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
TaskService taskService = (TaskService) context.getBean("taskService");
taskService.performJob();
try {
taskService.performExceptionJob();
} catch (Exception e) {
log.error("Error", e);
}
context.close();
}
}
spring-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
https://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
">
<context:annotation-config/>
<context:component-scan base-package="by.it.academy.offer.aop"/>
<aop:config>
<aop:pointcut id="performanceException"
expression="execution(* by.it.academy.offer.aop.TaskService.performExceptionJob())"/>
<aop:pointcut id="performance"
expression="execution(* by.it.academy.offer.aop.TaskService.performJob())"/>
<aop:aspect ref="work">
<aop:before pointcut-ref="performance" method="beforeWork"/>
<aop:after-returning pointcut-ref="performance" method="afterWork"/>
<aop:after-throwing pointcut-ref="performanceException" method="afterWorkProblems"/>
</aop:aspect>
</aop:config>
</beans>