Environment Construction of spring boot
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.