spring12-事务

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial spring支持的事务 似乎都是关于数据库的,可能也是我的水平问题,不知道其他的东西 大概需要实现两个,一个commit,另一个是rollback 事务是基于AOP实现的     阅读全文
fightinggg's avatar
fightinggg 4月 09, 2020

spring11-Jdbctemplate

    阅读全文
fightinggg's avatar
fightinggg 4月 08, 2020

mysql游标

    阅读全文
fightinggg's avatar
fightinggg 4月 08, 2020

网易笔试

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 第一题输入一个n,表示n个点的完全图,输入m表示后续有m个操作,输入s表示你站在s点这个位置接下来m行,每行两个数字x,y 如果x=0 表示与y相连的所有边断开 否则 表示边x-y断开 你需要输出一个数x,表示这m个操作的前x个操作可以让s点与其他所有点断开连接 12345678910111213set<int>se;for(int i=1;i<=m;i++){ cin>>x>>y; if(x==0) { if(y==s) return i; else se.insert(y); }else { if(x==s) se.inesrt(y); if(y==s) se.insert(x); } if(se.size()==n) return i;}return 0; 怎么说呢,我就是这样写的,显然se.size()==n写错了,应该说n-1,跟yg讲这题的时候才想起来,我原地爆炸了,一直怀疑题目有问题,然后只过了10%,到最后都没找到bug     阅读全文
fightinggg's avatar
fightinggg 4月 07, 2020

redis

    阅读全文
fightinggg's avatar
fightinggg 4月 07, 2020

mysql刷题1

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 查找最晚入职员工的所有信息查找最晚入职员工的所有信息CREATE TABLE employees (emp_no int(11) NOT NULL,birth_date date NOT NULL,first_name varchar(14) NOT NULL,last_name varchar(16) NOT NULL,gender char(1) NOT NULL,hire_date date NOT NULL,PRIMARY KEY (emp_no)); 我们排序以后选出最大的 123select * from employees order by hire_date desc limit 0,1 找到最大值以后使用where 12select * from employees where hire_date = (select max(hire_date) from employees);     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020

spring10-配置AOP

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial spring中的AOP 连接点,被拦截到的点,在spring中指的是方法 切入点,被增强的连接点 通知 在调用方法前的是前置通知,在后面的是后置通知,在catch中的是异常通知,在final中的是最终通知,整个invoke方法就是环绕通知 Target 被代理的对象     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020

spring9-动态代理

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial account案例&emsp;&emsp; 我们有一个转账方法: 根据名称找到账户,转出账户减钱,转入账户加钱,更新转出账户,更新转入账户,这个方法没有事务的控制,可能出现问题 案例问题&emsp;&emsp; 实际上我们需要维护一个和线程绑定的数据库连接,我们做一个工具类,让其支持回滚,于是我们在上诉案例中可以使用trycatch,一旦碰到问题,在catch中回滚即可,这个可以解决问题,但是太复杂了。     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020

spring8-spring整合junit

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial spring整合junit@RunWith 我们需要切换junit的main @ContextConfiguration 指定配置类或者配置文件 12345<dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.8.RELEASE</version></dependency>     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020

spring7-注解配置IOC

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 注解配置IOC 先总结一下之前的东西,曾经的XML配置,有标签id和class用于构造,有scope用来表示作用范围,有init-method和destroy-method用来表示生命周期,有property用来表示依赖注入 告知spring去扫描1234567891011121314<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 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/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"> <context:component-scan base-package="com.wsx.spring"></context:component-scan></beans>     阅读全文
fightinggg's avatar
fightinggg 4月 06, 2020