What is Spring Boot?
SpringBoot is a sub-project in the Spring project, and we are familiar with the Spring-framework is a Spring product, is used to simplify the Spring initial construction and development process using a specific way to configure, A separate Spring reference is created to run the main method. Nohup Java-jar — &, which simplifies the configuration of Maven and automatically configures Spring to add the corresponding starter automatic configuration.
What are the advantages of Spring Boot?
- Reduce development and testing time
- Using JavaConfig helps you avoid using XML.
- Avoid massive Maven imports and versioning conflicts.
- Provide advice on developing methods.
- Start development quickly by providing default values.
- No separate Web server is required. This means you no longer need to start Tomcat, Glassfish, or anything else.
- Less configuration is required because there is no web.xml file. Simply add the class annotated with @Configuration, then add the method annotated with @Bean, and Spring will automatically load the object and manage it as before. You can even add @AutoWired to the bean method to make Spring automatically load the required dependencies.
- Context-based configuration Using these properties, you can deliver the environment you are using to your application: -dspring.profiles. active = {enviorvulnerabilities}. After loading the main application properties file, Spring loads subsequent application properties files in (Application {environment}.properties).
What’s the difference between SpringBoot and SpringMVC?
SpringBoot is a framework for rapid development, which can quickly integrate third-party frameworks, simplify XML configuration, all in the form of annotations, built-in Tomcat container, to help developers to achieve rapid development, SpringBoot Web components default integration is the SpringMVC framework. SpringMVC is the control layer.
SpringBoot Quick start
Create an empty demo project as follows:
2. Introduce dependencies in POM.xml
The introduction of spring-boot-start-parent in pop.xml, which provides dependency management (DEPENDENCY management), is supported by stater Poms. Version is not required when declaring other dependencies, as you will see later. SpringBoot provides a project named spring-boot-starter-parent, which already manages the versions of various common dependencies (not all). Our project needs to be the parent project, so we don’t have to worry about the versions of dependencies, what dependencies need to be. Just introduce coordinates!
Start the test
The results of
The last
Thank you for reading here, the article has any shortcomings please correct, feel the article is helpful to you remember to give me a thumbs up, every day will share Java related technical articles or industry information, welcome to pay attention to and forward the article!