Today I learned the more popular framework spring Boot, feel Springboot's advantage lies in the support of various components, through a few short configuration can be done before a lot of operations to complete the plug-in implant. Let the programmer put more time on the thinking of business logic, Save time cost, this is my first time to write a blog, what bad place to hope that a lot of correction, the following to start Springboot study: Springboot Specific introduction can see other on-line introduction, here do not say, on these days of learning, personal understanding, in short: (1) It is the spring upgrade version, the spring container can do things, it can do, and more convenient, from the configuration form, Springboot completely abandoned the cumbersome way of XML file configuration, but instead of annotated way to achieve, although essentially, is similar (like packet scanning, annotation scanning, class loading, and so on). (2) Springboot integrated plug-in more, thus using a lot of services, all just introduce a dependency, a few annotations and Java classes can be used, specific reference related manuals. (3) In the Web application development of this piece, the previous application is generally packaged into a war package, and then published to the relevant server container (such as Tomcat), although Springboot can also do so, But the more common form under springboot is to package the Springboot app into an executable jar package file. The reason for this is that you can directly think of the Springboot application as a Java application, whose Web application can have no WebApp directory (not to mention XML), which recommends using HTML pages and using them as static resources. The following specific record, how to start from scratch under idea, step by step to build Springboot Web application, here is Maven for dependency management, novice start, have any questions, please refer to Springboot official website. It is necessary to note that Springboot relies on a JDK version of 1.8 and above. I. Create a new MAVEN project directly File----New project Select Maven, click Next: Two, fill in the project name three click Next to complete the creation of the MAVEN project, the directory structure is as follows: Four add spring boot dependencies through maven Copy Code 1 6 copy Code Five, complete the jar package import, create a new controller, complete the official spring boot instance (to ensure that Mavan downloads the dependent jar package for springboot): Copy code 1/** 2 * CreateD by Song on 2017/2/15. 3 * Test code in the official sample project 4 */5 @Controller 6 @EnableAutoConfiguration 7 public class Samplecontroller {8 @RequestMapping ("/") 9 @ResponseBody10 String Home () {One return "Hello world!"; }13 public static void Main (string[] args) throws Exception {Springapplication.run (samplecontroller.class, args); 16}17} Copy code note that there is a main function here, and then the Springboot application is typically packaged into an executable jar package for publishing, and this main function is the entry for the entire project. The reason why you can do this is because springboot even Tomcat8 as a plug-in, so it doesn't have to be the same as the previous SSM architecture, and you need to configure the war package under Tomcat to run. Directly click to run the main function, and then the browser link bar, enter the address http://localhost:8080/, you can see the printed string "Hello world!" The This is one of the most basic springboot-based Web applications available on the website, so it's easy. This essay draws lessons from: http://blog.csdn.net/u013248535/article/details/55100979
Learning Springboot Framework