Spring Cloud (ii): Spring Boot Technology Summary

Source: Internet
Author: User

1.Spring Bootsimplifies the initial setup and development of spring applications, saves development costs and time, and increases developer productivity


2. includes many out-of-the-box microservices capabilities to deploy projects with spring cloud can be run independently, provides application monitoring, and can be deployed in conjunction with MicroServices.


3. Spring Boot simplifies the configuration file, it uses "habits better than Configuration" (there are a lot of configurations in the project, plus a built-in configuration that allows you to run your project quickly with the idea that you don't have to manually configure them).

3.1, the project uses a lot of default configuration class, as long as the corresponding annotations, you can refer to the corresponding configuration file, of course, you can also manually write the configuration file.

         @SpringBootApplication: The core annotations of the Spring boot project, the main purpose of which is to turn on automatic configuration, is a combination of annotations, including annotations of @ springbootconfiguration+ @EnableAutoConfiguration + @ComponentScan .

@RestController annotations are equivalent to @responsebody + @Controller combined

@Configuration: This is a configuration class that configures spring.
@Controller: Indicate that this is a SPRINGMVC controller.

          @ResponseBody:  If you need to return Json,xml or customize mediatype content to the page, You need to add the @responsebody annotation to the corresponding method

          Main method: Launches an application in the Main method, which is the entry for this application.

4. If we do not want to use the default configuration in the program, you can exclude this configuration item by using annotations on the program-initiated class, @SpringBootApplication (exclude={ Mongodataautoconfiguration.class})


5, If we now use the SPRINGMVC function in the spring program, use annotations @enablewebmvc


6, when the project starts, we use the XML configuration file to initialize some beans, we have to take advantage of @importresoure (locations = {"Classpath:path"})


7, the use of spring oot upload files, you must use annotations @bean instantiation multipartconfigelement; If you jump to the appropriate JSP page, the materialized view parser Urlbasedviewresolver


8, define the Swagger configuration class, apiswaggerconfig inherit Webmvcconfigureradapter class, to implement the encoding of the configuration.


9. Finally run the Spring boot project, you can run Java application directly, or MAVEN command SPRING-BOOT:RUN;LIUNX environment to write a startup script yourself, or the command line to run the jar.

Spring Cloud (ii): Spring Boot Technology Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.