b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

dubbo jdk15_bcprov jdk15on_dubbo zookeeper(8)

电脑杂谈  发布时间:2017-04-30 04:04:00  来源:网络整理

4、spring的配置文件ApplicationContext.xml,有区别的就是这个文件中配置了dubbo

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://.springframework.org/schema/beans"
	xmlns:xsi="http://.w3.org/2001/XMLSchema-instance"
	 xmlns:tx="http://.springframework.org/schema/tx"
	xmlns:context="http://.springframework.org/schema/context"
	xmlns:aop="http://.springframework.org/schema/aop"
	xmlns:task="http://.springframework.org/schema/task"
	xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
	xsi:schemaLocation="http://.springframework.org/schema/beans 
	              http://.springframework.org/schema/beans/spring-beans-3.2.xsd
				  http://.springframework.org/schema/context
				  http://.springframework.org/schema/context/spring-context-3.2.xsd
				  http://.springframework.org/schema/aop 
                  http://.springframework.org/schema/aop/spring-aop.xsd		
                  http://.springframework.org/schema/task
                 http://.springframework.org/schema/task/spring-task-3.2.xsd
				 http://.springframework.org/schema/tx 
				 http://.springframework.org/schema/tx/spring-tx-3.2.xsd
				  http://code.alibabatech.com/schema/dubbo
        http://code.alibabatech.com/schema/dubbo/dubbo.xsd
				 ">

	<!-- 加载配置JDBC文件 -->
	<context:property-placeholder location="classpath:datasource.properties" />
	<!-- 数据源 -->
	
	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
	<property name="driverClassName">
		<value>${druid.driverClassName}</value>
	</property>
	<property name="url">
		<value>${druid.url}</value>
	</property>
	<property name="username">
		<value>${druid.username}</value>
	</property>
	<property name="password">
		<value>${druid.password}</value>
	</property>
   <property name="filters" value="stat" />  
	<property name="initialSize">
		<value>${druid.initialSize}</value>
	</property>
	<property name="minIdle">
		<value>${druid.minIdle}</value>
	</property>
	<property name="maxActive">
		<value>${druid.maxActive}</value>
	</property>
	<property name="maxWait">
		<value>${druid.maxWait}</value>
	</property>
	<property name="timeBetweenEvictionRunsMillis">
		<value>${druid.timeBetweenEvictionRunsMillis}</value>
	</property>
	<property name="minEvictableIdleTimeMillis">
		<value>${druid.minEvictableIdleTimeMillis}</value>
	</property>
	<property name="testWhileIdle">
		<value>${druid.testWhileIdle}</value>
	</property>
	<property name="testOnBorrow">
		<value>${druid.testOnBorrow}</value>
	</property>
	<property name="testOnReturn">
		<value>${druid.testOnReturn}</value>
	</property>
	<property name="poolPreparedStatements">
		<value>${druid.poolPreparedStatements}</value>
	</property>
	<property name="maxPoolPreparedStatementPerConnectionSize">
		<value>${druid.maxPoolPreparedStatementPerConnectionSize}</value>
	</property>
</bean>
	
	<context:component-scan base-package="com.test.dubbocli3.service ,com.test.dubbocli3.dao" />
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="" />
		<property name="mapperLocations" value="classpath:mapper/*.xml" />
	</bean>

	<!--其实这里类的实例就是mybatis中SQLSession -->
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg index="0">
			<ref bean="sqlSessionFactory" />
		</constructor-arg>
	</bean>
	
	<!-- dubbo配置 -->
	<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
	<dubbo:application name="consumer-of-helloworld-app-my" />      
	   <!-- 使用zookeeper广播注册中心暴露发现服务地址 -->
	<dubbo:registry  protocol="zookeeper"  address="192.168.0.103:2181" />    
	<!-- 和上面的一样 -->
	<!-- <dubbo:registry  address="zookeeper://192.168.0.101:2181" />    -->
	<!--本地伪集群配置 -->
	<!-- <dubbo:registry  protocol="zookeeper"  address="192.168.0.27:2181,192.168.0.27:2182,192.168.0.27:2183" /> -->
	<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->  
	<dubbo:reference id="demoServicemy" intece="com.test.dubboser3.service.UserService" />

</beans>
spring 的配置文件中只多了dubbo的这些配置,其他的还是一样的


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-44295-8.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 孟姣
      孟姣

      也解决了男人太多的问题

    热点图片
    拼命载入中...