请选择 进入手机版 | 继续访问电脑版

湖南新梦想

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1126|回复: 0

ssm环境搭建004

[复制链接]

7

主题

7

帖子

31

积分

新手上路

Rank: 1

积分
31
发表于 2023-9-21 00:06:52 | 显示全部楼层 |阅读模式
4.配置springMVC 注解扫描  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:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/s ... ing-context-3.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

        <context:component-scan base-package="com.pcp.controller"/>
        <context:component-scan base-package="com.pcp.config"/>
        <context:component-scan base-package="com.pcp.interceptor"/>
        <!--  告诉springmvc处理系统中静态资源的访问问题  -->
        <!--  springmvc默认的生效,当访问静态资源(css/js/图片...)找不到Controller的时候,就直接找到静态资源并返回  -->
        <!--  注意:这行配置会导致springmvc注解失效  -->
        <mvc:default-servlet-handler/>


        <!-- 让失效的注解重新生效   -->
        <mvc:annotation-driven/>

        <!--   配置springmvc做文件上传的文件上传解析器     -->
        <!--   当我们做文件上传时,这个解析器就会生效,会自动解析出上传文件中的数搪    -->
        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>

        <bean class="org.springframework.mail.javamail.JavaMailSenderImpl">
                <property name="host" value="smtp.qq.com"/>
                <property name="javaMailProperties">
                        <props>
                                <!-- 指定要进行身份验证 -->
                                <prop key="mail.smtp.auth">true</prop>
                                <!-- 指定连接超时时间 -->
                                <prop key="mail.smtp.timeout">20000</prop>
                        </props>
                </property>
                <!-- 指定电子邮件,目前指定个人邮箱,以后指定公司 -->
                <property name="username" value="1142522378@qq.com"/>
                <!-- 指定授权码,电子邮箱在程序中才能发送电子邮件 -->
                <property name="password" value="dxgjxpggjxjpjgdj"/>
                <!-- 指定字符编码 -->
                <property name="defaultEncoding" value="UTF-8"/>
        </bean>

</beans>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|湖南新梦想 ( 湘ICP备18019834号-2 )

GMT+8, 2023-11-28 23:23 , Processed in 0.041972 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表