V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  xuhaoyangx  ›  全部回复第 113 页 / 共 138 页
回复总数  2741
1 ... 109  110  111  112  113  114  115  116  117  118 ... 138  
@li24361 不好意思,我以为放出来了。
上面那个 applicationContext 给错了。
连接配置我是放在 applicationContext 的
<?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:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">

<description>Spring 公共配置</description>

<!-- 开启定时任务 -->
<task:annotation-driven />

<!-- MyBatis 配置 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 显式指定 Mapper 文件位置 -->
<property name="mapperLocations" value="classpath*:/mybatis/*Mapper.xml" />
<!-- mybatis 配置文件路径 -->
<property name="configLocation" value="classpath:/mybatis/config.xml" />
</bean>

<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
<!-- 这个执行器会批量执行更新语句, 还有 SIMPLE 和 REUSE -->
<!-- <constructor-arg index="1" value="BATCH" /> -->
</bean>

<!-- 扫描 basePackage 接口 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 映射器接口文件的包路径, -->
<property name="basePackage" value="com.xhy.asp.one.dao" />
</bean>

<!-- 使用 annotation 定义事务 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true" />

<!-- 数据源配置, 使用 Tomcat JDBC 连接池 -->
<!-- 阿里巴巴 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<!-- 基本属性 url 、 user 、 password -->
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />

<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${ds.initialSize}" />
<property name="minIdle" value="${ds.minIdle}" />
<property name="maxActive" value="${ds.maxActive}" />

<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${ds.maxWait}" />

<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="${ds.timeBetweenEvictionRunsMillis}" />

<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="${ds.minEvictableIdleTimeMillis}" />

<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />

<!-- 打开 PSCache ,并且指定每个连接上 PSCache 的大小 -->
<property name="poolPreparedStatements" value="false" />
<property name="maxPoolPreparedStatementPerConnectionSize"
value="20" />

<!-- 配置监控统计拦截的 filters -->
<property name="filters" value="stat" />
</bean>
<!-- <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
destroy-method="close"> Connection Info <property name="driverClassName"
value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property
name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}"
/> Connection Pooling Info <property name="maxActive" value="${jdbc.pool.maxActive}"
/> <property name="maxIdle" value="${jdbc.pool.maxIdle}" /> <property name="minIdle"
value="0" /> <property name="defaultAutoCommit" value="false" /> </bean> -->

<!-- production 环境 -->
<context:property-placeholder
ignore-unresolvable="true" file-encoding="utf-8" location="classpath:jdbc.properties" />

</beans>


jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/2015_repair?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=
##DataSource Global Setting

#配置初始化大小、最小、最大
ds.initialSize=1
ds.minIdle=1
ds.maxActive=20

#配置获取连接等待超时的时间
ds.maxWait=60000

#配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
ds.timeBetweenEvictionRunsMillis=60000

#配置一个连接在池中最小生存的时间,单位是毫秒
ds.minEvictableIdleTimeMillis=300000
@zacard 测试过,不是名字的问题
@ppwangs 恩,谢谢。正想找个替换 druid 的,这货有 bug ,官方还没怎么维护。


@zacard 恩,尝试下。
@cnhongwei ipv6 mac 至少我是默认禁用的,我用的是 127 连接的, mysql 的配置我就如下
最下面三行是为了减少 mysql 内存占用, sqlmode 是 5.6 默认。
port = 3306
bind-address=0.0.0.0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
performance_schema_max_table_instances=200
table_definition_cache=200
table_open_cache=128
应该不存在这样的问题
@buliugu 仔细看,我是启动 tomcat 就会有问题。
##applicationContext.xml

```xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" 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"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

<!--
spring 可以自动去扫描 base-package 下面或者子包下面的 java 文件,
如果扫描到有 @Component @Controller @Service @Repository 等这些注解的类,则把这些类注册为 bean
-->
<context:component-scan base-package="com.edu.szpt.sicrepair.*" />

<mvc:annotation-driven />

<!-- 静态资源问题 -->
<mvc:default-servlet-handler />

<!--
模型解析,在请求时为模型视图名称添加前后缀
比如在 controller 类中需要请求 /WEB-INF/page/index.jsp 文件,直接写 index 就可以了
-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

</beans>

```
习惯输域名
2016-01-27 09:09:54 +08:00
回复了 facat 创建的主题 宽带症候群 家庭布网线应该用 6 类线还是超 6 类线?
@auzeonfung 其实留好一点的尼龙线更好。线拉线如果断了,这线质量真不好
2016-01-26 14:47:36 +08:00
回复了 1998qiu 创建的主题 问与答 读计算机专业,考一所好大学真的很重要吗?
@wy315700 出来工作后还觉得没用的,是真没用
2016-01-26 09:15:11 +08:00
回复了 facat 创建的主题 宽带症候群 家庭布网线应该用 6 类线还是超 6 类线?
超 6 类还是有必要的,曾经和以前老师聊过,国外像学校等这些基本上都是默认 6 类-超 6 类来施工,还是好几年前( 08-09 年的时候?记不太清楚)。

超五类还是容易收到干扰,特别施工稍微不好,线路其实根本达不到 1G , 6 类-超 6 类这种,其实很多施工是做不了的,没有这个水平,这个可以要求施工方找有资质的施工这一方面,但是经费会多你懂的。


提醒楼主 3 点:
1.施工正规,先埋管道,后拉线。(必须)
2.屏蔽线必须两边网络设备都支持,不然白搭
3.为 10 年后考虑,尽量高上,可以同时埋光线,不做接口

@auzeonfung 其实正确的施工,不会这么麻烦,之所以会出现这种情况,绝大多数是,先在管道穿好了线,在埋管道,就会导致难以换线,如果是埋好管道,再通线,以后换线是十分方便的,直接老线绑新的,拉老线出来,新的就进去了,很轻松的。
2016-01-25 09:02:09 +08:00
回复了 decaywood 创建的主题 Apple RMBP15 的低配和高配哪个更适合码农??
独显的作用就是,以后升级了系统,独显的性能能让其支撑的更久点(流畅)。
2016-01-23 22:50:16 +08:00
回复了 Zachery 创建的主题 问与答 为何电信能侦测到"多设备正在共享网络"
2016-01-23 16:29:02 +08:00
回复了 tanpoyip 创建的主题 MacBook Pro 15rmbp 从桌子上掉下来碎屏了
@tanpoyip 同问
@yeyeye 好吧忘记你是空间了
2016-01-23 01:04:56 +08:00
回复了 Zachery 创建的主题 问与答 为何电信能侦测到"多设备正在共享网络"
@Zachery 可以通过 linux 的上的 ip 伪装骗过去,理论上。
现在就是走流程,今天刚去工信部投诉,反正我家是经常和电信撕逼, 100M 我都用了三年, 2 年来家里网络架构硬件都没变过,突然限速 1/3 简直不可忍。

最搞笑的,派上来的师傅说,电信没有做限制,他只管电脑接光猫拨号速度正常,结果我用 linux 拨号上网也被限速 2333 。然后继续 10000 号投诉,说接路由器设备就会被分流速度,两者互相冲突,做好撕到套餐结束的时候
2016-01-22 23:35:19 +08:00
回复了 Zachery 创建的主题 问与答 为何电信能侦测到"多设备正在共享网络"
@Zachery 深圳电信已经这么做,限速 1/3
@yeyeye 其实想了下-。-你用应用层层面拒绝访问,那还是有‘很大’的消耗额...
xmlrpc 的确是一个比较恶心的地方,我好像是把这东西关掉了?反正现在没这些痛点,我更多的是再防火墙层面,加了一些脚本和一些黑名单,现在访问也是不太好,但是基本确定是系统有问题导致 IO 延迟大,你可以尝试对 log 做些脚本动态加入防火墙进行防护
2016-01-22 23:28:42 +08:00
回复了 a81874678 创建的主题 iPhone 手机终于被冻关机了,系统最新 9.2.1
看来有空我也去检查下。
不要强迫症,其实我觉得 wp 卡和这些没多大关系
1 ... 109  110  111  112  113  114  115  116  117  118 ... 138  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   863 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 44ms · UTC 19:22 · PVG 03:22 · LAX 12:22 · JFK 15:22
Developed with CodeLauncher
♥ Do have faith in what you're doing.