gupaoedu-tom / spring5-samples Goto Github PK
View Code? Open in Web Editor NEW《Spring5核心原理与30个类手写实战》随书代码示例工程
《Spring5核心原理与30个类手写实战》随书代码示例工程
各种跑不通各种有问题,就不说那pom.xml里头多的那些plugins都是些啥了。
本身改改吧,根据自己对spring的理解,还能跑,然后看到这个文件,我惊了,惊得都懒得打英文了
GPAdvisedSupport
里头pattern的regex的处理是个啥东西?你来匹配你的logAspect文件的regex又去匹配handler的名字?还是toString的名字?????
这部分感觉有点绕,书上的代码跳来跳去的,看不太明白。。。
书上说完整代码让我们自行下载,所以书上只提供了部分代码,可是目前可供下载的代码里没有这一部分
花了一周多的时间看这本书,收获确实有,了解了整个过程,但是关于设计模式的运用还是没有讲的太清楚,以及orm的代码没有,在后半部分的学习中有点受阻,了解spring原理是够用的,很多细节也没有展开
Line 18:
@GPAutowired private IDemoService demoService;
Line 23-24:
String result = demoService.get(name);
// String result = "My name is " + name;
This is not gonna work. demoService is state as an implement class of IDemoService, but you never initial demoService, get() method will not run.
And this lead to the demoService in this class will be null all the time. Which means the class you put into the mappings in your com.gupaoedu.mvcframework.v1.servlet.GPDispatcherServlet have this as null as well. And the invoke() method will throw null exception.
I am a new learner to spring. But I can't run your code so I tried to find out what happened. I think you have the same problem so that the line 24 is not used.
时序图用什么工具画的
com.gupaoedu.mvcframework.v2.servlet.GPDispatcherServlet#doDispatch 方法中参数处理后保存到paramValues,没见到那里有用到。
函数doScanner里获取url应该是:
URL url = this.getClass().getClassLoader().getResource(scanPackage.replaceAll("\.","/")); getResource使用的是相对路径,不是绝对路径。
函数init里for (String className : mapping.keySet()) {} 这个循环里有问题,因为循环里改动了mapping,往mapping里面放入对象,导致循环出现bug;应该在循环之前把mapping深拷贝一份,为tmpMapping。
如: Map<String,Object> tmpMapping = new HashMap<String, Object>();
for (String className : mapping.keySet()) {
tmpMapping.put(className, mapping.get(className));
}
循环的时候使用tmpMapping
for (String className : tmpMapping.keySet()) {}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.