What are the good designs of the service framework as a java web framework
preface
Recently, I need to develop a pure api project. From scratch to the completion of the development of the complete proxy function, it only took less than four hours. I lamented the efficiency.
About the birth of service framework
The service framework is an old, Java based web framework. In my impression, it should be my work in 11 years. At that time, it should be the time when Ruby on rails was on fire. I worked as a rails programmer for a period of time. Later, I transformed to search. During this period, I felt that there was no easy-to-use web framework, so I developed the service framework.
Minimalist requirements
In the early years, the clumsiness of Java language has been widely criticized. There are hundreds of lines of code and configuration before two lines of business. First of all, we can't change the language, so how to achieve extreme simplicity? The routine of automatically generating source code is certainly not good. Users generate source code through various commands every day, and the usually generated source code is ugly and ugly and dare not change. Therefore, we need to quietly generate the necessary code for users, which can not be seen by users. We also need to take into account the code prompt of IDE. So, how should we play? The core lies in two points. We will talk about the following exhibitions:
运行时代码生成(codegen,功能增强)+ 父类方法签名(代码提示)
What is the ultimate simplicity
Application include container
In the early years, almost all the codes were run in containers (Weblogic, Tomcat, etc.). In the 11th year, SF made an important design, that is, HTTP is only an interactive way for code exposure. Like RPC, web container is only a component in your running code. Therefore, the startup of SF is like this (the demo code is written in scala):