Spring configuration file and springmvc config file Web. xml configuration file save for your own use

Source: Internet
Author: User
Tags aop

Not much to say, recently on the weekend to take time to write some of the framework of the system, when everything needs to be configured to find that they do not remember so many classes and paths, so the daily summary becomes particularly important
Db-config.properties The configuration file constants are presented to use the

multiple times.

Hibernate.dialect=org.hibernate.dialect.mysql5innodbdialect Hibernate.hbm2ddl.auto=none Hibernate.show_sql=true
Hibernate.format_sql=true Hibernate.query.substitutions=true 1, False 0 hibernate.default_batch_fetch_size=16 hibernate.max_fetch_depth=2 hibernate.bytecode.use_reflection_optimizer=true #hibernate. cache.use_second_level_ Cache=true #hibernate. Cache.use_query_cache=true #hibernate. cache.region.factory_class=
Org.hibernate.cache.EhCacheRegionFactory #net. Sf.ehcache.configurationresourcename=/ehcache_hibernate.xml Hibernate.cache.use_structured_entries=true hibernate.generate_statistics=true Hibernate.enable_lazy_load_no_ Trans=true Connection.provider_class = Org.hibernate.c3p0.internal.C3P0ConnectionProvider hibernate.c3p0.min_size= 5 hibernate.c3p0.max_size=20 hibernate.c3p0.timeout=300 hibernate.c3p0.idle_test_period=3000 hibernate.c3p0.max_ Statements=50 hibernate.c3p0.validate=true hibernate.c3p0.acquire_increment=2 connection.driver_class= Com.mysql.jdbc.Driver Connection.url=jdbc:mysql://localhost:3306/dormitory?autoreconnect=true&autoreconnectforpools=true&useunicode=true
&characterencoding=utf8 connection.username=root connection.password=123456 c3p0.minPoolSize=3
c3p0.maxpoolsize=10 c3p0.initialpoolsize=3 c3p0.maxidletime=60 c3p0.acquireincrement=3 c3p0.maxStatements=0
c3p0.idleconnectiontestperiod=60 c3p0.acquireretryattempts=30 C3p0.breakafteracquirefailure=false C3p0.testconnectiononcheckout=false C3p0.testconnectiononcheckin=false c3p0.debugunreturnedconnectionstacktraces =true c3p0.unreturnedconnectiontimeout=90

Spring-config.xml introducing a declared constant profile

<?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:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP" xmlns:tx= " Http://www.springframework.org/schema/tx "xmlns:context=" Http://www.springframework.org/schema/context "xmlns: task= "Http://www.springframework.org/schema/task" xmlns:mvc= "Http://www.springframework.org/schema/mvc" xsi: schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.0.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/ Spring-aop-4.0.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ Spring-tx-4.0.xsd Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/ Spring-context-4.0.xsd Http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd Http://www.springframework.org/schema/mvc http:/ /www.springframework.org/schema/mvc/spring-mvc-4.0.xsd "> <!--scan the corresponding package and then-<context:annotation- Config base-package= "Com.vrv.common.service"/> <context:annotation-config base-package= "Com.vrv.common.dao" /> <context:annotation-config base-package= "Com.vrv.system.dao"/> <context:annotation-config Bas
       E-package= "Com.vrv.system.service"/> <context:annotation-config base-package= "Com.vrv.buss.service"/> <!--Properties File configuration Introduction--<bean id= "Propertyconfigurer" class= "org.springframework.beans.factory.conf Ig. Propertyplaceholderconfigurer "> <property name=" Locations "> <list> &LT;VALUE&GT;CLASSP ath:*-config.properties</value> </list> </property> </bean> <!--data Library Configuration-<Bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" > <!-- Specifies the driver for the connection database--<property name= "Driverclass" value= "${connection.driver_class}"/> <!--Specify the connection database
        URL--<property name= "Jdbcurl" value= "${connection.url}"/> <!--Specify the user name to connect to the database-- <property name= "user" value= "${connection.username}"/> <!--Specify the password to connect to the database--<property name= "Password" value= "${connection.password}"/> <!--Specify the maximum number of connections to connect to the database connection pool--<property name= "Maxpool Size "value=" ${c3p0.maxpoolsize} "/> <!--Specify the minimum number of connections to connect to the database connection pool-<property name=" Minpoolsize "va Lue= "${c3p0.minpoolsize}"/> <!--Specify the number of initialization connections to connect to the database connection pool-<property name= "Initialpoolsize" value = "${c3p0.initialpoolsize}"/> <!--specify maximum idle time for connections to the database connection pool--<property name= "MaxIdleTime" value = "${c3p0.maxidletime}"/> <!--c3p0 The number of connections that are fetched at the same time when the connection in the connection pool is exhausted. Default:3--<property name= "Acquireincrement" > <value>${c3p0.acquireincrement}</v Alue> </property> <!--the standard parameters of JDBC to control the number of preparedstatements loaded within the data source. However, because the pre-cached statements belong to a single connection instead of the entire connection pool. 
            So setting this parameter takes into account a variety of factors. If both maxstatements and maxstatementsperconnection are 0, the cache is closed. default:0--<property name= "maxstatements" > &LT;VALUE&GT;${C3P0.MAXSTATEMENTS}&LT;/VALUE&G
        T </property> <!--Check for idle connections in all connection pools every 60 seconds. default:0--<property name= "Idleconnectiontestperiod" > <value>${c3p0.idleconnectiont Estperiod}</value> </property> <!--defines the number of repeated attempts to obtain a new connection from the database after a failure. Default:30--<property name= "acquireretryattempts" > <value>${c3p0.acquireretryattemp Ts}</value> </property> <!--getting a connection failure will cause all the threads waiting on the connection pool to get the connection thrownAbnormal. However, the data source is still valid and continues to try to get the connection the next time you call Getconnection (). If set to True, the data source will declare broken and permanently shut down after attempting to acquire a connection failure. Default:false--<property name= "Breakafteracquirefailure" > <value>${c3p0.breakaftera Cquirefailure}</value> </property> <!--because of the high performance consumption, please use it only when you need it. If set to true then the validity of each connection submission is officer. We recommend using methods such as Idleconnectiontestperiod or automatictesttable to improve the performance of your connectivity tests. Default:false--<property name= "Testconnectiononcheckout" > <value>${c3p0.testconnect Iononcheckout}</value> </property> <!--configuration Disconnect Auto Deadweight--<property name= "test

        Connectiononcheckin "> <value>${c3p0.testConnectionOnCheckin}</value> </property> <!--leak monitoring--<property name= "Unreturnedconnectiontimeout" > <value>${c3p0. Unreturnedconnectiontimeout}</value> </property> <property Name= "Debugunreturnedconnectionstacktraces" > <value>${c3p0.debugUnreturnedConnectionStackTraces}< /value> </property> </bean> <!--Configure Spring Sessionfactory-<bean id= "ses Sionfactory "class=" Org.springframework.orm.hibernate4.LocalSessionFactoryBean "> <property name=" DataSource
                "Ref=" DataSource "></property> <property name=" Packagestoscan "> <list> 
                  <value>com.vrv.buss.entity.*</value> <value>com.vrv.common.entity.*</value>        
        <value>com.vrv.system.entity.*</value> </list> </property> <!--metabase local dialect, and so on-<property name= "Hibernateproperties" > <props&gt
                ; <prop key= "Javax.persistence.validation.mode" >none</prop> <prop key= "Hibernate.dialect" > ${hibernate.dialect}</prop> <prop key= "Hibernate.show_sql" >${hibernate.show_sql}</prop> <prop key= "Hibernate.format_sql" >true</prop> <prop key= "Hibernate.hbm2ddl.auto" &G t;${hibernate.hbm2ddl.auto}</prop> <prop key= "Hibernate.query.substitutions" >${hibernate.query .substitutions}</prop> <prop key= "Hibernate.default_batch_fetch_size" &GT;${HIBERNATE.DEFAULT_BATC h_fetch_size}</prop> <prop key= "Hibernate.max_fetch_depth" &GT;${HIBERNATE.MAX_FETCH_DEPTH}&LT;/PR
                op> <prop key= "Hibernate.generate_statistics" >${hibernate.generate_statistics}</prop> <prop key= "Hibernate.bytecode.use_reflection_optimizer" ></prop> <prop key= "Hiber Nate.enable_lazy_load_no_trans ">${hibernate.enable_lazy_load_no_trans}</prop> <prop key=" Conne Ction.provider_class ";${connection.provider_class}</prop> <!--open Query Cache-<prop key= "Hibe Rnate.cache.use_query_cache ">true</prop> <!--turn on level two cache--<prop key="   
                Hibernate.cache.use_second_level_cache ">true</prop> <!--cache provider-- <!--because spring also uses ehcache, both sides are guaranteed to use the same cache manager--<prop key= "Hibernate.cache.region.factory_class" & 
                gt;org.hibernate.cache.ehcache.singletonehcacheregionfactory</prop> <!--min Connections-- <prop key= "Hibernate.c3p0.min_size" >${hibernate.c3p0.min_size}</prop> <!--maximum number of connections-- > <prop key= "hibernate.c3p0.max_size" >${hibernate.c3p0.max_size}</prop> &lt ;! --Get the connection timeout, if more than this time, will throw an exception, in milliseconds--and <prop key= "Hibernate.c3p0.timeout" >${hibernate.c3p0.timeout}
        </prop>        <!--check for idle connections in the connection pool every 3,000 seconds, in seconds--<prop key= "Hibernate.c3p0.idle_test_period" >${hiberna te.c3p0.idle_test_period}</prop> <!--maximum result set for queries--<prop key= "hibernate.c3p0
                . max_statements ">${hibernate.c3p0.max_statements}</prop> <!--Verify that the connection is available every time- <prop key= "Hibernate.c3p0.validate" >${hibernate.c3p0.validate}</prop> <!--when the connection pool is exhausted Wait, c3p0. Gets the new number of connections--<prop key= "Hibernate.c3p0.acquire_increment" >${hibernate.c3p0.acquire_increm ent}</prop> </props> </property> </bean> <!--configuration transaction Manager- -<bean id= "TransactionManager" class= "Org.springframework.orm.hibernate4.HibernateTransactionManag Er "> <property name=" sessionfactory "ref=" Sessionfactory "/> &lt ;p roperty name= "DatasourCe "ref=" DataSource "/> </bean> <!--Transaction Propagation Properties Configuration-<tx:advice id=" Txadvice "Transactio N-manager= "TransactionManager" > <tx:attributes> <tx:method name= "save*" propagation= "Requi RED "/> <tx:method name=" del* "propagation=" REQUIRED "/> <tx:method name=" update* "pro pagation= "REQUIRED"/> <tx:method name= "add*" propagation= "REQUIRED"/> <tx:method nam E= "find*" propagation= "REQUIRED"/> <tx:method name= "get*" propagation= "REQUIRED"/> < Tx:method name= "apply*" propagation= "REQUIRED" read-only= "true"/> <tx:method name= "*" propagation= "REQUI
    RED "read-only=" true "/> </tx:attributes> </tx:advice> <!--Configure the class that participates in the transaction to define a transaction entry point-- <aop:config> <aop:pointcut id= "txpointcut" expression= "Execution (* COM.VRV). Se

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.