没有伞就要努力奔跑 2016-11-22 02:58 采纳率: 0%
浏览 2184

移动端app后台框架,springmvc+spring+mybatis占用服务器内存太大是什么原因

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"
default-lazy-init="true">
<!-- Annotation Config -->
context:annotation-config/
<!-- mvc:annotation-driven/ -->
<!-- 扫描Service -->

<!-- jdbcTemplate -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource" />
</bean>

<!-- spring Task -->
<!-- <task:scheduled-tasks>
    <task:scheduled ref="taskJob" method="" cron=""/>
</task:scheduled-tasks>
<context:component-scan base-package=""></context:component-scan> -->

<!-- spring Task Annotation -->
<context:component-scan base-package="smart.smartutil.*"></context:component-scan>
<task:annotation-driven scheduler="myScheduler"/>
<task:scheduler id="myScheduler" pool-size="5"/>

<!-- ***************配置数据源************** -->
<!-- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:jeecg/template/jeecg_database.properties"></property>
</bean> -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name = "driverClassName" value = "com.microsoft.sqlserver.jdbc.SQLServerDriver" />

    <property name="url" value=""></property>
    <property name="username"><value>   </value></property>
    <property name="password"><value></value></property>
    <!-- 初始化连接大小 -->  
    <!-- 连接池最大使用连接数量 -->
    <property name="maxActive" value="10" />
    <!-- 连接池最大空闲 -->
    <property name="maxIdle" value="10" />
    <!-- 连接池最小空闲 -->
    <property name="minIdle" value="0" />
    <!-- 获取连接最大等待时间 -->
    <property name="maxWait" value="90000" />
    <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
    <property name="timeBetweenEvictionRunsMillis" value="60000" />
    <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
    <property name="minEvictableIdleTimeMillis" value="25200000" />
</bean>

<!-- ***************事务配置************** -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
</bean>

<aop:config>
    <aop:advisor pointcut="execution(* com.jeecg.service.*.*(..))"  advice-ref="txAdvice" />
    <aop:advisor pointcut="execution(* smart.service.*.*(..))"  advice-ref="txAdvice" />
    <aop:advisor pointcut="execution(* scott.service.*.*(..))"  advice-ref="txAdvice" />
    <!--
            <aop:aspect id="LogAspect" ref="logBean">
               <aop:pointcut id="smartService"  expression="execution(* smart.service.*.*(..))" />
               <aop:pointcut id="baseService"  expression="execution(* com.base.service.*.*(..))" />
               <aop:pointcut id="jeecgService"  expression="execution(* com.jeecg.service.*.*(..))" />
     -->
    <!--            <aop:before pointcut-ref="smartService" method="doBefore"/>   -->
    <!--            <aop:after pointcut-ref="smartService" method="doAfter"/>   -->
    <!--
               <aop:around pointcut-ref="smartService" method="doAround"/>
               <aop:around pointcut-ref="baseService" method="doAround"/>
               <aop:around pointcut-ref="jeecgService" method="doAround"/>
     -->
    <!--            <aop:after-throwing pointcut-ref="smartService" method="doThrowing" throwing="ex"/>   -->
    <!--
           </aop:aspect>
     -->
</aop:config>

<bean id="logBean" class="com.base.util.LogAspect" />

<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="get*" read-only="true" />
        <tx:method name="query*" read-only="true" />
        <tx:method name="find*" read-only="true" />
        <tx:method name="load*" read-only="true" />
        <tx:method name="select*" read-only="true" />
        <tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
    </tx:attributes>
</tx:advice>

<!-- 扫描 MyBatis Sql -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mapperLocations">
        <list>
            <!-- <value>classpath:com/jeecg/mapper/*Mapper.xml</value>
            <value>classpath:scott/mapper/*/*Mapper.xml</value> -->
            <value>classpath:smart/mapper/*Mapper.xml</value>
        </list>
    </property>
    <property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>

<!-- 扫描mapper.java  -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" autowire="byName">
    <property name="basePackage" value="com.jeecg.dao,scott.dao.*,smart.dao" />
    <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>


<!-- Spring 工具类 -->
<bean id="springContextUtil" class="com.base.util.SpringContextUtil" />

  • 写回答

2条回答 默认 最新

  • 半杯凉月 2016-11-22 03:49
    关注

    用jvisualvm工具,查看具体是哪个线程占用资源比较大,然后具体再查找原因

    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿