Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".
npx @tessl/cli install tessl/maven-org-springframework-boot--spring-boot@3.5.0Spring Boot makes it easy to create stand-alone, production-grade Spring-based applications that you can "just run." It provides opinionated defaults, auto-configuration, and embedded servers to reduce boilerplate code and configuration. Spring Boot follows a convention-over-configuration approach, allowing developers to quickly bootstrap applications with minimal setup while maintaining full customizability.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>3.5.3</version>
</dependency>For Gradle:
implementation 'org.springframework.boot:spring-boot:3.5.3'import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;For web applications:
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.Banner;For configuration binding:
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.BindResult;
import org.springframework.boot.convert.ApplicationConversionService;
import org.springframework.core.env.Environment;
import org.springframework.context.ConfigurableApplicationContext;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}Advanced application setup with custom configuration:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.Banner;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(MyApplication.class);
app.setWebApplicationType(WebApplicationType.SERVLET);
app.setBannerMode(Banner.Mode.CONSOLE);
app.setAdditionalProfiles("dev", "debug");
app.run(args);
}
}Spring Boot Core is organized around several key architectural components:
SpringApplication class handles application lifecycle, context creation, and configuration loading@ConfigurationProperties and Binder for type-safe configurationApplicationConversionService for property binding and data formattingCore application startup and lifecycle management with SpringApplication class. Handles context creation, configuration loading, and application initialization.
/**
* Main entry point for Spring Boot applications
*/
public class SpringApplication {
/**
* Static convenience method to run a Spring Boot application
* @param primarySource the primary source class
* @param args command line arguments
* @return the running ApplicationContext
*/
public static ConfigurableApplicationContext run(Class<?> primarySource, String... args);
/**
* Run the Spring application with multiple source classes
* @param primarySources array of primary source classes
* @param args command line arguments
* @return the running ApplicationContext
*/
public static ConfigurableApplicationContext run(Class<?>[] primarySources, String[] args);
/**
* Set the web application type
* @param webApplicationType the web application type to set
*/
public void setWebApplicationType(WebApplicationType webApplicationType);
/**
* Set additional active profiles
* @param profiles profile names to activate
*/
public void setAdditionalProfiles(String... profiles);
}Type-safe configuration binding system that maps external properties to Java objects with validation support.
/**
* Annotation for binding external configuration properties to Java objects
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ConfigurationProperties {
/**
* The property prefix (alias for prefix)
* @return the property prefix
*/
String value() default "";
/**
* The property prefix (alias for value)
* @return the property prefix
*/
String prefix() default "";
/**
* Whether to ignore invalid field bindings
* @return true to ignore invalid fields
*/
boolean ignoreInvalidFields() default false;
/**
* Whether to ignore unknown properties
* @return true to ignore unknown properties
*/
boolean ignoreUnknownFields() default true;
}
/**
* Core class for binding configuration properties
*/
public class Binder {
/**
* Get a Binder for the given Environment
* @param environment the environment to bind from
* @return a Binder instance
*/
public static Binder get(Environment environment);
/**
* Bind properties to a target class
* @param name the property name prefix
* @param target the target class to bind to
* @return bind result with bound instance
*/
public <T> BindResult<T> bind(String name, Class<T> target);
}Web application type detection and context management for servlet and reactive applications.
/**
* Enumeration of web application types
*/
public enum WebApplicationType {
/** Not a web application */
NONE,
/** Servlet-based web application */
SERVLET,
/** Reactive web application */
REACTIVE;
/**
* Deduce the web application type from the classpath
* @return the detected web application type
*/
public static WebApplicationType deduceFromClasspath();
}Comprehensive lifecycle events for monitoring application startup, shutdown, and availability states.
/**
* Event published when application is starting up
*/
public class ApplicationStartingEvent extends SpringApplicationEvent {
public SpringApplication getSpringApplication();
public String[] getArgs();
}
/**
* Event published when application environment is prepared
*/
public class ApplicationEnvironmentPreparedEvent extends SpringApplicationEvent {
public ConfigurableEnvironment getEnvironment();
}
/**
* Event published when application context is ready to service requests
*/
public class ApplicationReadyEvent extends SpringApplicationEvent {
public ConfigurableApplicationContext getApplicationContext();
}Logging system abstraction with support for multiple logging frameworks and configuration.
/**
* Abstraction for logging system configuration
*/
public abstract class LoggingSystem {
/**
* Get the logging system for the current classpath
* @param classLoader the class loader to use
* @return the logging system or null if none available
*/
public static LoggingSystem get(ClassLoader classLoader);
}
/**
* Log levels supported by Spring Boot
*/
public enum LogLevel {
TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
}Enhanced conversion service with Spring Boot converters for durations, data sizes, and collections.
/**
* ConversionService implementation with Spring Boot converters
*/
public class ApplicationConversionService extends DefaultFormattingConversionService {
/**
* Get a shared ApplicationConversionService instance
* @return the shared conversion service
*/
public static ConversionService getSharedInstance();
/**
* Configure a FormatterRegistry with Spring Boot converters
* @param registry the registry to configure
*/
public static void configure(FormatterRegistry registry);
}JSON parsing abstraction with support for multiple JSON libraries.
/**
* JSON parsing abstraction
*/
public interface JsonParser {
/**
* Parse JSON string to Map
* @param json the JSON string to parse
* @return parsed map representation
*/
Map<String, Object> parseMap(String json);
/**
* Parse JSON string to List
* @param json the JSON string to parse
* @return parsed list representation
*/
List<Object> parseList(String json);
}/**
* Provides access to application startup arguments
*/
public interface ApplicationArguments {
/**
* Get the raw unprocessed arguments
* @return array of source arguments
*/
String[] getSourceArgs();
/**
* Get names of all option arguments
* @return set of option names
*/
Set<String> getOptionNames();
/**
* Check if a specific option exists
* @param name the option name to check
* @return true if option exists
*/
boolean containsOption(String name);
/**
* Get values for a specific option
* @param name the option name
* @return list of values for the option
*/
List<String> getOptionValues(String name);
/**
* Get non-option arguments
* @return list of non-option arguments
*/
List<String> getNonOptionArgs();
}
/**
* Interface for generating exit codes on application shutdown
*/
public interface ExitCodeGenerator {
/**
* Return the exit code that should be returned from the application
* @return the exit code
*/
int getExitCode();
}
/**
* Strategy interface for creating ApplicationContext instances
*/
public interface ApplicationContextFactory {
/**
* Create a new ApplicationContext for the given web application type
* @param webApplicationType the web application type
* @return the created application context
*/
ConfigurableApplicationContext create(WebApplicationType webApplicationType);
}