Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Environment Construction of spring boot

Shulou Source: shulou.com Published: 2022-06-03 07:10:51 09月23日 Update

4.0.0

Springstart

Com.zcp.springstart

1.0.0

Jar

UTF-8

1.7

1.7

Org.springframework.boot

Spring-boot-dependencies

1.5.8.RELEASE

Pom

Import

Org.springframework.boot

Spring-boot-starter

How to start the entry of spring boot

Package com.zcp.springstart

Import org.springframework.boot.SpringApplication

Import org.springframework.boot.autoconfigure.SpringBootApplication

Import org.springframework.context.ConfigurableApplicationContext

Import org.springframework.context.annotation.Bean

@ SpringBootApplication

Public class App {

@ Bean

Public Runnable createRunnable () {

Return new Runnable () {

@ Override

Public void run () {

System.out.println ("> runn-")

}

}

}

Public static void main (String [] args) {

ConfigurableApplicationContext context = SpringApplication.run (App.class, args)

Context.getBean (Runnable.class) .run ()

}

}

Description: the startup entry class of springboot defaults to the configuration class, so you can inject bean into this class.

Tags: Entry mode configuration environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Redmi OPPO Reno vpn Shulou Technology