當(dāng)前位置:
首頁 >
SSM框架的搭建(idea)
發(fā)布時(shí)間:2025/5/22
32
豆豆
生活随笔
收集整理的這篇文章主要介紹了
SSM框架的搭建(idea)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
SSM框架的搭建(idea)
首先建立項(xiàng)目:
一路下一步即可
導(dǎo)入依賴(context,mysql,mybatis,druid)
第一個(gè):config-spring.xml
第二個(gè):config-springmvc.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"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"><!--配置springmvc框架的注解的掃描范圍,在加載時(shí)需要掃描的注解范圍擴(kuò)展:springboot是通過 main方法所在類確定掃描范圍;main方法所在包及其子包作為spring的掃描范圍--><context:component-scan base-package="com.example"></context:component-scan><!-- springmvc框架的內(nèi)部資源視圖解析器,完成向view層頁面的轉(zhuǎn)發(fā)和解析處理 --><bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/><property name="prefix" value="/WEB-INF/logined/"/><property name="suffix" value=".jsp"/></bean></beans>第三個(gè):db.properties
driverClassName=com.mysql.cj.jdbc.Driver useUnicode=true&characterEncoding=utf8 url=jdbc:mysql://localhost:3306/practical_training?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong&allowPublicKeyRetrieval=true username=root password=123456 initialSize=2 maxActive=20 minIdle=0 maxWait=60000 validationQuery=SELECT 1 FROM DUAL testOnBorrow=false testOnReturn=false testWhileIdle=true timeBetweenEvictionRunsMillis=60000 minEvictableIdleTimeMillis=25200000 removeAbandoned=true removeAbandonedTimeout=1800 logAbandoned=true filters=mergeStat詳見代碼參考搭建gitee地址:
gitee倉庫
總結(jié)
以上是生活随笔為你收集整理的SSM框架的搭建(idea)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis框架使用generator
- 下一篇: @Configuration