刚接触spring-mvc ,接触了一个helloworld的输出测试,结果一直显示500错误,真的是网上办法找遍也没能解决问题,都是泪啊。我这边的问题就是xml文件配置的时候使用的是idea默认的配置,结果少了一些配置就顺理成章的出错了,血的校训。建议官网去找完整的xml配置文件来使用。
页面报500,控制台出现错误:通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明
粗心大意,一开始并未注意到这个错误,以为是我自己哪里语法写的有问题,对着视频看了N遍也没发现出错的,idea默认的可真多坑!!!!!!!!!!
配一个我这边能够运行的xml文件配置吧!!!哭死,这也是我去菜鸟教程里面找到的配置,心累!
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com"></context:component-scan>
</beans>