Spring header information
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd">
Spring integrates mybatis
<!-- Database connection pool --> <!-- Load configuration file --> <context:property-placeholder location="classpath:conf/*.properties" /> <!-- database connection pool <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="driverClassName" value="${jdbc.driver}" /> <property name="maxActive" value="10" /> <property name="minIdle" value="5" /> </bean>--> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${jdbc.driver}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxPoolSize" value="10"/> <property name="minPoolSize" value="3"/> <property name="acquireIncrement" value="1"/> </bean> <!-- Let spring manage sqlsessionfactory using mybatis and spring integration package --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- Database connection pool --> <property name="dataSource" ref="dataSource" /> <!-- Load the global configuration file of mybatis--> <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" /> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="cn.e3mall.mapper" /> </bean>
Spring 's transaction transaction
<!-- Transaction Manager --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!-- datasource--> <property name="dataSource" ref="dataSource" /> </bean> <!-- NOTIFICATION--> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <!-- Propagation behavior --> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="create*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="find*" propagation="SUPPORTS" read-only="true" /> <tx:method name="select*" propagation="SUPPORTS" read-only="true" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> <!-- facet--> <aop:config> <aop:advisor advice-ref="txAdvice" pointcut="execution(* cn.e3mall.service..*.*(..))" /> </aop:config>
Spring integrates dubbo
Publish service to zookeeper
<!-- Configure Packet Scanner--> <context:component-scan base-package="cn.e3mall.service"/> <!-- Use dubbo to publish service --> <!-- provider application information for calculating dependencies --> <dubbo:application name="e3-manager" /> <dubbo:registry protocol="zookeeper" address="192.168.25.129:2181" /> <!-- Expose services on port 20880 using the dubbo protocol --> <dubbo:protocol name="dubbo" port="20880" /> <!-- Declare the service interface that needs to be exposed --> <dubbo:service interface="cn.e3mall.service.ItemService" ref="itemService" /> <dubbo:service interface="cn.e3mall.service.ItemCatService" ref="itemCatService" />Application services are configured in the control layer
Spring -integrated ActiveMQ
producer of information
<!-- The ConnectionFactory that can really generate Connection is provided by the corresponding JMS service vendor --> <bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://192.168.25.129:61616" /> </bean> <!-- The ConnectionFactory that Spring uses to manage the real ConnectionFactory --> <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory"> <!-- The target ConnectionFactory corresponds to the real ConnectionFactory that can generate JMS Connection --> <property name="targetConnectionFactory" ref="targetConnectionFactory" /> </bean> <!-- Configure producer --> <!-- The JMS tool class provided by Spring, which can send and receive messages, etc. --> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <!-- This connectionFactory corresponds to the ConnectionFactory object provided by Spring we defined --> <property name="connectionFactory" ref="connectionFactory" /> </bean> <!--This is the queue destination, point-to-point --> <bean id="queueDestination" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg> <value>spring-queue</value> </constructor-arg> </bean> <!--This is the theme destination, one-to-many--> <bean id="topicDestination" class="org.apache.activemq.command.ActiveMQTopic"> <constructor-arg value="topic" /> </bean>
recipient of information
<!-- The ConnectionFactory that can really generate Connection is provided by the corresponding JMS service vendor --> <bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://192.168.25.129:61616" /> </bean> <!-- The ConnectionFactory that Spring uses to manage the real ConnectionFactory --> <bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory"> <!-- The target ConnectionFactory corresponds to the real ConnectionFactory that can generate JMS Connection --> <property name="targetConnectionFactory" ref="targetConnectionFactory" /> </bean> <!-- Receive message--> <!-- configure listener --> <bean id="searchMessageListener" class="cn.e3mall.search.listener.SearchMessageListener" /> <!-- Message listener container--> <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactory" /> <property name="destination" ref="topicDestination" /> <!-- configure listener --> <property name="messageListener" ref="searchMessageListener" /> </bean> <!--This is the queue destination, point-to-point --> <bean id="queueDestination" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg> <value>spring-queue</value> </constructor-arg> </bean> <!--This is the theme destination, one-to-many--> <bean id="topicDestination" class="org.apache.activemq.command.ActiveMQTopic"> <constructor-arg value="topic" /> </bean>
Spring -integrated Solr
<bean id="httpSolrClient" class="org.apache.solr.client.solrj.impl.HttpSolrClient"> <constructor-arg index="0" value="http://192.168.25.129:8188/solr/collection1"/> </bean>
Keep updating ing....