- 博客(46)
- 收藏
- 关注
原创 Java编译及初始化过程
1. Java编译机制java的编译是指从.java文件到.class文件的过程, java的编译过程主要包括词法分析,语法分析, 语义分析,代码生成的过程。 java源代码 词法分析, 将源代码转换成Token流,Token包括Java关键字, 自定义单词(包名、类名、变量名等),符号(+,-等) ...
2019-04-21 13:51:18
336
原创 Java内部类
Java内部类是指定义在类内部或者方法内部的类,主要可以分为四种,成员内部类, 成员内部类是指作为类的成员出现的类; 局部内部类, 局部内部类是指定义在方法中的类,只能在对应的方法内部使用 静态内部类, 静态内部类是指static修饰的成员内部类 匿名内部类, 匿名内部类是可以不进行声明的类import java.util.concurrent.Executor;public ...
2019-04-18 23:53:04
288
原创 guava做本地缓存
package tool;import com.google.common.cache.CacheBuilder;import com.google.common.cache.CacheLoader;import com.google.common.cache.LoadingCache;import java.util.Optional;import java.util.Random;...
2017-12-03 20:51:36
1241
原创 Mockito与Spring中@Autowired与@InjectMocks组合
@InjectMocks @Autowired private TestClass testClass; @Mock private TestClassPropertyA testClassPropertyA; //TestClass 若只想mock TestClass 其中的属性testClassPropertyA,其他属性仍使用真实调用;//则需要对Test
2017-07-14 21:14:49
8848
原创 Java动态代理--cglib代理
cglib代理是建立一个类的子类,然后通过这个子类去访问原来的类。package jyl.mix.proxy.cglib;import java.lang.reflect.Method;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.cglib.proxy.MethodInte
2017-06-28 20:28:13
379
原创 Java动态代理--jdk代理
Java动态代理为实例对象提供一个模仿者,这个模仿者不仅可以拥有真是类的行为,还可以自定义的添加一些内容;aop中大量的应用了动态代理机制。 jdk代理根据类的接口生成代理,因此jdk只能为实现了接口的类进行代理。
2017-06-28 20:10:56
307
原创 Java虚拟机学习记录,HotSpot对象创建
使用new关键字创建普通对象(非Array、Class等对象?)的过程查找类信息 根据new指令的参数去确认对应的类信息是否已经被加载、解析、初始化过,如果上述过程完成,则进行下一步;如果没有,则需要首先对类进行加载、解析、初始化。分配内存 当类被加载完成后,类对应对象的内存大小就可以确定了,普通对象的内存可以分为三部分,对象头、实例数据、填充数据。 a.对象头 对象头包括两部分,自身运
2017-06-22 21:01:10
254
原创 Java虚拟机学习记录,数据区域
程序计数器 线程私有, 标记每个线程运行的位置虚拟机栈 线程私有,存储局部变量表、操作数栈、动态链接、方法返回地址 局部变量表:存储编译期可知的基本类型、引用类型、returnAddress类型数据 操作数栈: 动态链接: 方法返回地址:方法执行完成后需要回到开始执行的位置,继续原来程序执行堆 所有线程共有,所有的对象实例都需要在堆分配内存方法区 所有线程共有,存储
2017-06-22 19:40:54
192
原创 SpringBoot aop demo
package jyl.mix.springbootaop.aop;import com.google.gson.Gson;import java.util.Arrays;import javax.servlet.http.HttpServletRequest;import org.aspectj.lang.JoinPoint;import org.aspectj.lang.annotati
2017-06-20 21:31:28
318
原创 inteallij gradle 错误: 编码GBK的不可映射字符 XXXX
在gradle project中加入 tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
2017-06-15 15:53:33
941
1
原创 Dubbo服务调用问题
1.Forbid consumer XXX access service com.diit.facade.operation.service.UserFacade from registry 127.0.0.1:2181 use dubbo version 2.8.4, Please check registry access list (whitelist/blacklist)配置的provide
2017-06-13 22:33:46
477
原创 Java注解
package jyl.mix.annotation;import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Inherited;import java.lang.annotation.Retention;import java.lan
2017-06-12 21:18:02
225
原创 Jackson命名转换
Jackson命名转换jackson在java对象与json字段之间的转换,提供三种默认的转换规则, 即继承自PropertyNamingStrategyBase的类有三个PascalCaseStrategy:首字母变为大写LowerCaseWithUnderscoresStrategy:小写字母+下划线,java对象属性名的大写字母会转换成小写字母+下划线的形式LowerCaseS
2017-06-09 19:49:55
1104
原创 Spring 的 @Transactional事务
错误原因记录:@Transactional 以aop形式对异常进行拦截, 该注解放在某方法上,只有从类的外部调用该方法的时候才能生效;(父子类之间也可以生效)
2017-06-07 18:33:33
341
原创 Spring集成redis(pipeline方式)
1.maven添加spring、redis、log4j依赖properties设置 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>4.3.0.RELEASE...
2016-12-26 23:23:41
3938
原创 LeetCode 5.Longest Palindromic Substring
1. manacher算法 22mspublic class Solution { private int min(int a, int b){ return a < b ? a : b; } public String longestPalindrome(String s) { if (null == s |
2016-12-26 23:05:53
267
原创 LeetCode 3.Longest Substring Without Repeating Characters
1.动态规划 54 ms (1)last[] 存储当前字符的上一个相同字符的下标,-1表示在当前字符之前不存在相同的 如字符串abbac 对应的last为-1 -1 1 0 -1 (2)状态转移 start[]存储以当前字符结尾的最长子串的开始位置,也就是说此时对应的字串应该为s(start[i]…i) 对于当前位置i, 如果last[i
2016-12-22 22:23:26
205
原创 LeetCode 1.Two Sum
1.39 ms 暴力 public class Solution { public int[] twoSum(int[] nums, int target) { int first = 0; int second = 0; for (first = 0; first < nums.length; first++
2016-12-21 23:24:25
290
原创 Spring 集成Redis遇到问题nested exception is java.lang.ClassNotFoundException: redis.clients.jedis.JedisPoo
Spring 集成Redis遇到问题nested exception is java.lang.ClassNotFoundException: redis.clients.jedis.JedisPoolConfig但实际已在pom.xml中添加依赖 可能是jedis的版本问题,将jedis版本修改后问题解决(待研究)Exception in thread "main" org.spr...
2016-12-11 15:45:43
13896
12
原创 Eclipse+Maven下Spring与Hibernate整合简单实例(小白入门)
Maven管理Spring与Hibernate整合简单实例源码地址:https://github.com/1663727338/SSH-Study1.创建Maven工程 如下图选择quickstart 输入maven工程项目名称 2.创建工程文件夹src/main/resources,用来存放spring、hibernate所需的配置文件 3.在pom.xm...
2016-12-10 15:00:03
3950
原创 Mysql 命令积累总结
查看当前用户下数据库:show databases; 查看数据库中所有表:show tables; 查看表所有属性:show columns from XXX;
2016-12-09 22:50:22
449
原创 Class 'org.springframework.orm.hibernate3.LocalSessionFactoryBean' not found
利用MyEclipse搭建SSH框架时遇到错误,Class ‘org.springframework.orm.hibernate3.LocalSessionFactoryBean’ not found由错误描述可推测为某些包未导入, 解决方法: pom.xml中添加对spring-orm的依赖 <dependency> ...
2016-12-04 20:11:25
2484
原创 KMP算法理解
KMP讲解Kmp算法,模式匹配。。。目前效率最高的匹配算法 朴素的算法 o(n*m) 比如 要在 abcabcabcaba 中查找子串 abcaba朴素的算法 第一次匹配 到了箭头的地方失配了 朴素的算法接下来会从原串的第二个字符比较于是,从箭头处开始比较,马上就失配了,但是kmp鄙视这种做法,kmp认为这次比较是可以省略的
2015-04-20 08:41:17
461
原创 hdu1811
居然不能用vector #include #include using namespace std; #define maxn 10005 int A[maxn*2],B[maxn*2],in[maxn]; char ch[maxn*2]; struct Edge { int to;int next;}edge[2*maxn]; in
2014-07-05 23:12:42
457
原创 LA4043
#include #include #include #include using namespace std;#define maxn 110#define esp 1e-8double inf=1000000.0;double dis(double x1,double y1,double x2,double y2){ return s
2014-05-21 16:42:46
531
原创 poj3897
#include <iostream>#include <cstring>#include <queue>#include <cstdio>#include <cmath>#include <string>using namespace std;#define eps 1e-8#define maxn 105...
2014-05-11 20:07:47
602
原创 poj3254
#include using namespace std;#define mod 100000000#define maxn (112)+1bool map[14][14];int dp[2][maxn];int n,m;int son[maxn];void dfs(int x,int k,int y,int& top,bool can[]){ if(k>m)
2014-05-09 12:22:40
408
原创 poj1305
#include #include #include #include #include #include using namespace std; mapstring,int>mp;#define maxn 10000 +10string s[maxn];int main(){ int top=0; for(;cin>>s[top];) { if(s[to
2014-05-07 13:22:36
472
原创 poj1019
#include #include #include #include #include using namespace std; //buzhida typedef long long int LLint; int main() { int kase; LLint n; for(cin>>kase;kase--;)
2014-05-06 21:35:48
436
原创 poj1017
#include using namespace std;int main(){ int a[6]; while(cin>>a[0]) { int sum=a[0]; for(int i=1;i6;i++)cin>>a[i],sum+=a[i];
2014-05-06 18:27:31
422
原创 poj1061
#include using namespace std; typedef long long int LLint; LLint exgcd(LLint a,LLint b,LLint& x,LLint& y) { if(!b){x=1,y=0;return a;} else { LLint d=exg
2014-05-05 18:22:18
398
原创 hdu3711
123456789101112131415161718192021222324252627282930313233343536373839 #include #include using namespace std; int
2014-05-04 21:50:52
384
原创 poj2992
#include using namespace std;//又是#define maxn 433int pri[85];int num[maxn];int vis[maxn]={0};int top=0;void produce(){ for(int i=3;imaxn;i+=2) if(!vis[i]) { for(int
2014-04-30 20:41:58
476
原创 poj2007
#include #include using namespace std;//struct upoint{double x;double y;};upoint ipoint[55];bool cmp(upoint a,upoint b){ return a.xb.x||(a.yb.y&&a.x==b.x);}int stack[55];doub
2014-04-30 18:58:27
589
原创 poj1228
#include #include #include using namespace std;#define esp 1e-8struct upoint{double x;double y;}Point[1003];int stack[1003];int N;double Xmult(upoint a,upoint b,upoint c){ retu
2014-04-30 18:30:27
622
原创 poj1365
数论水题 #include #include #include using namespace std;struct yinzi{int x;int u;}p[200];void output(int n){ memset(p,0,sizeof(p)); int top=0; if(n%2==0) { p[top].x=2;
2014-04-28 19:35:44
746
原创 poj2234
#include using namespace std;int main(){ int n; for(;scanf("%d",&n)==1;) { int win=0; for(int i=0;in;i++)
2014-04-18 21:43:47
496
原创 poj2425
#include #include #include #include using namespace std; #define maxn 1002 int map[maxn][maxn]; int sg[maxn]; int DFS(int x,int n) { if(sg[x]!=-1)return sg[x]; in
2014-04-18 21:24:51
610
原创 poj1698
#include #include #include #include #include using namespace std;#define maxn 380#define inf 0x7fffffffint Cp[maxn][maxn];int flow[maxn];int pre[maxn];int S,T;int D[22];queue
2014-04-15 22:40:17
541
原创 poj1273
#include #include #include #include #include #include using namespace std;queueQ;#define inf 0x7fffffff#define maxn 202int n,m;int map[maxn][maxn];int flow[maxn];int pre[maxn
2014-04-15 21:07:24
449
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人