SpringBoot打包,Spring Boot Questions- Part 1

 2023-10-18 阅读 33 评论 0

摘要:What is Spring Boot?Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.You can use Spring Boot to create Java applications that can be started using java -jar or more traditional war deplo
  • What is Spring Boot?

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.
You can use Spring Boot to create Java applications that can be started using java -jar or more traditional war deployments.

?

  • What are the advantages of spring boot application?

SpringBoot打包,Provide a range of non-functional features that are common to large classes of projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).
Opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss.
Absolutely no code generation and no requirement for XML configuration.
Provide a radically faster and widely accessible getting started experience for all Spring development.

?

  • What are the?requirements of?Spring boot System?

Spring Boot 1.5.9.RELEASE requires
Java 7 +
Spring 4.3.13 +

springboot2?For build support
Maven 3.2+
Gradle 2.9+

Container Support
Tomcat 7+
Jetty 8+ (Jetty 9.3 requires JDK 8 +)

Read more?Spring boot system requirements

Springboot教程、?

  • What are the use of @EnableAutoConfiguration annotation?

This annotation tells Spring Boot to “guess” how you will want to configure Spring, based on the jar dependencies that you have added.

Read more?@enableautoconfiguration spring boot example

Spring boot、//和最后一個一起看一下

?

  • What is Spring Boot Starter?

Spring Boot provides a number of “Starters” that make easy to manage dependencies for your project.

Read More?Spring boot starter

//一系列 starter

?

  • What is spring-boot-starter-parent?

The spring-boot-starter-parent is a special starter that makes Maven or Gradle dependency-management easier by adding jars to your classpath.

Read More?spring-boot-starter-parent

//需要看一下鏈接

?

  • What is spring-boot-starter-web?

This starter will add Tomcat and Spring MVC dependency to our application and its default configuration.

Read More?spring-boot-starter-web

//需要看一下鏈接

?

  • How to create an executable jar using spring boot?

Add this below plugin to pom.xml

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins>
</build>

Use mvn clean package to create executable jar file

Read More?spring boot executable jar example

?

  • How do you run and stop spring boot executable jar?

Open cmd or shell window and use java -jar as shown below

$ java -jar myproject-0.0.1-SNAPSHOT.jar

To stop use ctrl+C

Read More?run spring boot jar from command line

?

  • How do you change JDK version in spring boot?

Java 1.6 as the default compiler level.
You can overwrite it by adding java.version property tag as shown below

<properties><java.version>1.8</java.version>
</properties>

  • How to disable specific auto-configuration in spring boot?

You can use exclude property as shown below to disable specific auto configuration

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

  • What is the use of @SpringBootApplication annotation?

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes

Since many spring Boot developers have their main class annotated with @Configuration, @EnableAutoConfiguration and @ComponentScan, spring boot provides you a new annotation @SpringBootApplication as replacement.

//這個三個注解的作用?

轉載于:https://www.cnblogs.com/vicky-project/p/9192903.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/149882.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息