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.00
# Spring Boot Core
1
2
Spring 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.
3
4
## Package Information
5
6
- **Package Name**: org.springframework.boot:spring-boot
7
- **Package Type**: Maven
8
- **Language**: Java
9
- **Version**: 3.5.3
10
- **Minimum Java Version**: Java 17+
11
- **Installation**:
12
13
```xml
14
<dependency>
15
<groupId>org.springframework.boot</groupId>
16
<artifactId>spring-boot</artifactId>
17
<version>3.5.3</version>
18
</dependency>
19
```
20
21
For Gradle:
22
23
```gradle
24
implementation 'org.springframework.boot:spring-boot:3.5.3'
25
```
26
27
## Core Imports
28
29
```java
30
import org.springframework.boot.SpringApplication;
31
import org.springframework.boot.autoconfigure.SpringBootApplication;
32
import org.springframework.boot.context.properties.ConfigurationProperties;
33
import org.springframework.boot.context.properties.EnableConfigurationProperties;
34
import org.springframework.boot.ApplicationRunner;
35
import org.springframework.boot.CommandLineRunner;
36
```
37
38
For web applications:
39
40
```java
41
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
42
import org.springframework.boot.WebApplicationType;
43
import org.springframework.boot.Banner;
44
```
45
46
For configuration binding:
47
48
```java
49
import org.springframework.boot.context.properties.bind.Binder;
50
import org.springframework.boot.context.properties.bind.Bindable;
51
import org.springframework.boot.context.properties.bind.BindResult;
52
import org.springframework.boot.convert.ApplicationConversionService;
53
import org.springframework.core.env.Environment;
54
import org.springframework.context.ConfigurableApplicationContext;
55
```
56
57
## Basic Usage
58
59
```java
60
import org.springframework.boot.SpringApplication;
61
import org.springframework.boot.autoconfigure.SpringBootApplication;
62
63
@SpringBootApplication
64
public class MyApplication {
65
public static void main(String[] args) {
66
SpringApplication.run(MyApplication.class, args);
67
}
68
}
69
```
70
71
Advanced application setup with custom configuration:
72
73
```java
74
import org.springframework.boot.SpringApplication;
75
import org.springframework.boot.WebApplicationType;
76
import org.springframework.boot.Banner;
77
78
@SpringBootApplication
79
public class MyApplication {
80
public static void main(String[] args) {
81
SpringApplication app = new SpringApplication(MyApplication.class);
82
app.setWebApplicationType(WebApplicationType.SERVLET);
83
app.setBannerMode(Banner.Mode.CONSOLE);
84
app.setAdditionalProfiles("dev", "debug");
85
app.run(args);
86
}
87
}
88
```
89
90
## Architecture
91
92
Spring Boot Core is organized around several key architectural components:
93
94
- **Application Bootstrapping**: `SpringApplication` class handles application lifecycle, context creation, and configuration loading
95
- **Configuration Management**: Property binding system with `@ConfigurationProperties` and `Binder` for type-safe configuration
96
- **Web Application Support**: Automatic detection and configuration of web application types (Servlet, Reactive, None)
97
- **Event System**: Comprehensive application lifecycle events for startup, shutdown, and readiness states
98
- **Conversion System**: Enhanced type conversion with `ApplicationConversionService` for property binding and data formatting
99
- **Auto-Configuration**: Foundation for Spring Boot's auto-configuration mechanism through context factories and initializers
100
101
## Capabilities
102
103
### Application Bootstrapping
104
105
Core application startup and lifecycle management with `SpringApplication` class. Handles context creation, configuration loading, and application initialization.
106
107
```java { .api }
108
/**
109
* Main entry point for Spring Boot applications
110
*/
111
public class SpringApplication {
112
113
/**
114
* Static convenience method to run a Spring Boot application
115
* @param primarySource the primary source class
116
* @param args command line arguments
117
* @return the running ApplicationContext
118
*/
119
public static ConfigurableApplicationContext run(Class<?> primarySource, String... args);
120
121
/**
122
* Run the Spring application with multiple source classes
123
* @param primarySources array of primary source classes
124
* @param args command line arguments
125
* @return the running ApplicationContext
126
*/
127
public static ConfigurableApplicationContext run(Class<?>[] primarySources, String[] args);
128
129
/**
130
* Set the web application type
131
* @param webApplicationType the web application type to set
132
*/
133
public void setWebApplicationType(WebApplicationType webApplicationType);
134
135
/**
136
* Set additional active profiles
137
* @param profiles profile names to activate
138
*/
139
public void setAdditionalProfiles(String... profiles);
140
}
141
```
142
143
[Application Management](./application.md)
144
145
### Configuration Properties
146
147
Type-safe configuration binding system that maps external properties to Java objects with validation support.
148
149
```java { .api }
150
/**
151
* Annotation for binding external configuration properties to Java objects
152
*/
153
@Target({ElementType.TYPE, ElementType.METHOD})
154
@Retention(RetentionPolicy.RUNTIME)
155
public @interface ConfigurationProperties {
156
/**
157
* The property prefix (alias for prefix)
158
* @return the property prefix
159
*/
160
String value() default "";
161
162
/**
163
* The property prefix (alias for value)
164
* @return the property prefix
165
*/
166
String prefix() default "";
167
168
/**
169
* Whether to ignore invalid field bindings
170
* @return true to ignore invalid fields
171
*/
172
boolean ignoreInvalidFields() default false;
173
174
/**
175
* Whether to ignore unknown properties
176
* @return true to ignore unknown properties
177
*/
178
boolean ignoreUnknownFields() default true;
179
}
180
181
/**
182
* Core class for binding configuration properties
183
*/
184
public class Binder {
185
/**
186
* Get a Binder for the given Environment
187
* @param environment the environment to bind from
188
* @return a Binder instance
189
*/
190
public static Binder get(Environment environment);
191
192
/**
193
* Bind properties to a target class
194
* @param name the property name prefix
195
* @param target the target class to bind to
196
* @return bind result with bound instance
197
*/
198
public <T> BindResult<T> bind(String name, Class<T> target);
199
}
200
```
201
202
[Configuration Management](./configuration.md)
203
204
### Web Application Support
205
206
Web application type detection and context management for servlet and reactive applications.
207
208
```java { .api }
209
/**
210
* Enumeration of web application types
211
*/
212
public enum WebApplicationType {
213
/** Not a web application */
214
NONE,
215
/** Servlet-based web application */
216
SERVLET,
217
/** Reactive web application */
218
REACTIVE;
219
220
/**
221
* Deduce the web application type from the classpath
222
* @return the detected web application type
223
*/
224
public static WebApplicationType deduceFromClasspath();
225
}
226
```
227
228
[Web Application Types](./web.md)
229
230
### Application Context Events
231
232
Comprehensive lifecycle events for monitoring application startup, shutdown, and availability states.
233
234
```java { .api }
235
/**
236
* Event published when application is starting up
237
*/
238
public class ApplicationStartingEvent extends SpringApplicationEvent {
239
public SpringApplication getSpringApplication();
240
public String[] getArgs();
241
}
242
243
/**
244
* Event published when application environment is prepared
245
*/
246
public class ApplicationEnvironmentPreparedEvent extends SpringApplicationEvent {
247
public ConfigurableEnvironment getEnvironment();
248
}
249
250
/**
251
* Event published when application context is ready to service requests
252
*/
253
public class ApplicationReadyEvent extends SpringApplicationEvent {
254
public ConfigurableApplicationContext getApplicationContext();
255
}
256
```
257
258
[Context Lifecycle](./context.md)
259
260
### Logging System
261
262
Logging system abstraction with support for multiple logging frameworks and configuration.
263
264
```java { .api }
265
/**
266
* Abstraction for logging system configuration
267
*/
268
public abstract class LoggingSystem {
269
/**
270
* Get the logging system for the current classpath
271
* @param classLoader the class loader to use
272
* @return the logging system or null if none available
273
*/
274
public static LoggingSystem get(ClassLoader classLoader);
275
}
276
277
/**
278
* Log levels supported by Spring Boot
279
*/
280
public enum LogLevel {
281
TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
282
}
283
```
284
285
[Logging Configuration](./logging.md)
286
287
### Type Conversion Service
288
289
Enhanced conversion service with Spring Boot converters for durations, data sizes, and collections.
290
291
```java { .api }
292
/**
293
* ConversionService implementation with Spring Boot converters
294
*/
295
public class ApplicationConversionService extends DefaultFormattingConversionService {
296
/**
297
* Get a shared ApplicationConversionService instance
298
* @return the shared conversion service
299
*/
300
public static ConversionService getSharedInstance();
301
302
/**
303
* Configure a FormatterRegistry with Spring Boot converters
304
* @param registry the registry to configure
305
*/
306
public static void configure(FormatterRegistry registry);
307
}
308
```
309
310
[Type Conversion](./conversion.md)
311
312
### JSON Processing
313
314
JSON parsing abstraction with support for multiple JSON libraries.
315
316
```java { .api }
317
/**
318
* JSON parsing abstraction
319
*/
320
public interface JsonParser {
321
/**
322
* Parse JSON string to Map
323
* @param json the JSON string to parse
324
* @return parsed map representation
325
*/
326
Map<String, Object> parseMap(String json);
327
328
/**
329
* Parse JSON string to List
330
* @param json the JSON string to parse
331
* @return parsed list representation
332
*/
333
List<Object> parseList(String json);
334
}
335
```
336
337
[JSON Processing](./json.md)
338
339
## Core Types
340
341
```java { .api }
342
/**
343
* Provides access to application startup arguments
344
*/
345
public interface ApplicationArguments {
346
/**
347
* Get the raw unprocessed arguments
348
* @return array of source arguments
349
*/
350
String[] getSourceArgs();
351
352
/**
353
* Get names of all option arguments
354
* @return set of option names
355
*/
356
Set<String> getOptionNames();
357
358
/**
359
* Check if a specific option exists
360
* @param name the option name to check
361
* @return true if option exists
362
*/
363
boolean containsOption(String name);
364
365
/**
366
* Get values for a specific option
367
* @param name the option name
368
* @return list of values for the option
369
*/
370
List<String> getOptionValues(String name);
371
372
/**
373
* Get non-option arguments
374
* @return list of non-option arguments
375
*/
376
List<String> getNonOptionArgs();
377
}
378
379
/**
380
* Interface for generating exit codes on application shutdown
381
*/
382
public interface ExitCodeGenerator {
383
/**
384
* Return the exit code that should be returned from the application
385
* @return the exit code
386
*/
387
int getExitCode();
388
}
389
390
/**
391
* Strategy interface for creating ApplicationContext instances
392
*/
393
public interface ApplicationContextFactory {
394
/**
395
* Create a new ApplicationContext for the given web application type
396
* @param webApplicationType the web application type
397
* @return the created application context
398
*/
399
ConfigurableApplicationContext create(WebApplicationType webApplicationType);
400
}
401
```