1. spring配置文件中添加context命名空间
注意:2需要手动添加,IDE一般不会自动添加,如果不添加会报如下错误:
Line 19 in XML document from class path resource [applicationContext-cxf.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ‘context:annotation-config’.
2. 启用注解装配,spring容器默认是禁用注解装配的
<context:annotation-config />