maven工程web層的spring配置文檔
阿新 • • 發佈:2017-06-27
pat nco clas log instance clu expr ons --
1、引入jdbc配置文檔
2、掃描文件
3、上傳文件的設置
下面是例子:
<?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" xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> <!-- 引入jdbc配置文件 --> <context:property-placeholderlocation="classpath:properties/jdbc.properties" /> <!-- 掃描文件 --> <context:component-scan base-package="com.mmc.d4alc"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> <context:exclude-filtertype="annotation" expression="org.springframework.web.bind.annotation.RestController" /> <context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" /> </context:component-scan> <!-- 上傳文件的設置 ,maxUploadSize=-1,表示無窮大。uploadTempDir為上傳的臨時目錄 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="UTF-8" p:maxUploadSize="-1" p:uploadTempDir="file" /> <bean id="info" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <array> <value>classpath:properties/info.properties</value> <value>classpath:properties/fileupload.properties</value> </array> </property> </bean> </beans>
maven工程web層的spring配置文檔