spring的扫描配置
<!-- 自动注册并检查@Required,@Autowired的属性注入 -->
<context:component-scan base-package="com.xzm"></context:component-scan>
<!-- 配置C3P0数据源 -->
<context:property-placeholder ignore-resource-not-found="true" location="classpath*:com/xzm/config/spring/db.properties" />
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${c3p0.mysql.driverClass}" />
<property name="jdbcUrl" value="${c3p0.jdbcUrl}" />
<property name="user" value="${c3p0.user}" />
<property name="password" value="${c3p0.password}" />
<property name="minPoolSize" value="${c3p0.minPoolSize}" />
<property name="maxPoolSize" value="${c3p0.maxPoolSize}" />
<property name="initialPoolSize" value="${c3p0.initialPoolSize}" />
<property name="acquireIncrement" value="${c3p0.acquireIncrement}" />
<property name="acquireRetryAttempts" value="${c3p0.acquireRetryAttempts}" />
<property name="maxIdleTime" value="${c3p0.maxIdleTime}" />
</bean>
SpringMVC
<!-- 自动扫描包下@Controller -->
<context:component-scan base-package="com.xzm"></context:component-scan>
<!-- 添加注解支持 -->
<mvc:annotation-driven />
<context:annotation-config />
<!-- 定义JSP文件的位置 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>

浙公网安备 33010602011771号