使用Intellij進行SpringMVC網站開發問題總結

1. Spring配置文件:元素 "context:component-scan" 的前綴 "context" 未綁定。

   

解決方案:

更改 xsi:schemaLocation,爲如下內容

<?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"
       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">

    <!--指明 controller 所在包,並掃描其中的註解-->
    <context:component-scan base-package="com.yinghan.controller"/>
</beans>


2. pom.xml文件的依賴報錯,需要重新下載依賴包

解決方法:

pom.xml文件右擊,Maven ——reimport


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章