Spring Boot Questions-part 1

Source: Internet
Author: User

    • What is Spring Boot?

Spring Boot makes it easy to create stand-alone, Production-grade Spring based applications so you can "just run".
You can use the Spring Boot to create Java applications the can be started using Java-jar or more traditional war deployment S.

    • What is the advantages of spring boot application?

Provide a range of non-functional features that is 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 is the Requirements of Spring boot System?

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

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

    • What is the use of @EnableAutoConfiguration annotation?

This annotation tells Spring Boot to "guess" what you'll want to configure Spring, based on the jar dependencies that's you Have added.

Read more @enableautoconfiguration Spring Boot example

    • What is Spring Boot Starter?

Spring Boot provides a number of "starters" that do easy-to-manage dependencies for your project.

Read More Spring Boot starter

    • What is Spring-boot-starter-parent?

The spring-boot-starter-parent is a special starter this 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 would 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 does the 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 does the 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 @SpringBootApplication annotation?

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

Since Many spring Boot developers has their main class annotated with @Configuration, @EnableAutoConfiguration and @Compo Nentscan, Spring boot provides you a new annotation @SpringBootApplication as replacement.

Spring Boot Questions-part 1

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.