### onStartup Method Implementation Example (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/servlet/ServletContextInitializer Example of how to implement the onStartup method from the ServletContextInitializer interface to configure a ServletContext. This method is responsible for adding servlets, filters, listeners, and context parameters. ```java import javax.servlet.ServletContext; import javax.servlet.ServletException; public class MyInitializer implements ServletContextInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { // Configure servlets, filters, listeners, context-params, attributes here System.out.println("Configuring ServletContext..."); // Example: servletContext.addServlet(...); // Example: servletContext.addFilter(...); // Example: servletContext.addListener(...); } } ``` -------------------------------- ### Start Recording Startup Steps - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup Manually starts the recording of startup steps. This method can be used to reset the recording process, provided no steps have been recorded yet. It marks the beginning of the StartupTimeline. ```java public void startRecording() { // ... implementation details ... } ``` -------------------------------- ### UndertowServletWebServerFactory WebServer Creation (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory Illustrates the method used by UndertowServletWebServerFactory to get a configured WebServer instance. This method takes ServletContextInitializer objects to apply specific configurations to the web server before it is started. ```java WebServer getWebServer(ServletContextInitializer... initializers) ``` -------------------------------- ### EndpointServlet Methods for Configuration (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/actuate/endpoint/web/EndpointServlet Illustrates deprecated methods for configuring an EndpointServlet. These methods allow setting initialization parameters and the load-on-startup priority for the servlet. The `withLoadOnStartup` method returns a new instance with the specified priority. ```java public EndpointServlet withInitParameter(String name, String value) // Deprecated, for removal: This API element is subject to removal in a future version. public EndpointServlet withInitParameters(Map initParameters) // Deprecated, for removal: This API element is subject to removal in a future version. public EndpointServlet withLoadOnStartup(int loadOnStartup) // Deprecated, for removal: This API element is subject to removal in a future version. // Sets the `loadOnStartup` priority that will be set on Servlet registration. ``` -------------------------------- ### Get SSL Certificate Validity Start Date - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/info/SslInfo Retrieves the start date of the SSL certificate's validity period as an Instant. This method is part of the SslInfo.CertificateInfo class in Spring Boot. ```java public Instant getValidityStarts() ``` -------------------------------- ### BufferingApplicationStartup Methods Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup Provides details on methods for managing startup step recording and retrieval, including adding filters and accessing buffered timelines. ```APIDOC ## startRecording() ### Description Start the recording of steps and mark the beginning of the `StartupTimeline`. The class constructor already implicitly calls this, but it is possible to reset it as long as steps have not been recorded already. ### Method `void` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) N/A #### Response Example None ### Throws `IllegalStateException` - if called and `StartupStep` have been recorded already. ``` ```APIDOC ## addFilter(Predicate filter) ### Description Add a predicate filter to the list of existing ones. A `step` that doesn't match all filters will not be recorded. ### Method `void` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) N/A #### Response Example None ``` ```APIDOC ## start(String name) ### Description Starts a new startup step with the given name. ### Method `StartupStep` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Returns the `StartupStep` object representing the newly started step. #### Response Example None ``` ```APIDOC ## getBufferedTimeline() ### Description Return the `timeline` as a snapshot of currently buffered steps. This will not remove steps from the buffer, see `drainBufferedTimeline()` for its counterpart. ### Method `StartupTimeline` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **timeline** (StartupTimeline) - a snapshot of currently buffered steps. #### Response Example None ``` ```APIDOC ## drainBufferedTimeline() ### Description Return the `timeline` by pulling steps from the buffer. This removes steps from the buffer, see `getBufferedTimeline()` for its read-only counterpart. ### Method `StartupTimeline` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **timeline** (StartupTimeline) - buffered steps drained from the buffer. #### Response Example None ``` -------------------------------- ### Get Web Server Instance - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory Retrieves a configured but paused WebServer instance. The server is ready to start but requires an explicit start call, typically managed by the Spring application context. ```java public WebServer getWebServer(HttpHandler httpHandler) ``` -------------------------------- ### BufferingApplicationStartup Constructor Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup Initializes a new buffered ApplicationStartup with a specified capacity, starting the recording of startup steps. ```APIDOC ## BufferingApplicationStartup(int capacity) ### Description Create a new buffered `ApplicationStartup` with a limited capacity and starts the recording of steps. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (N/A) N/A #### Response Example None ``` -------------------------------- ### Get StartupTimeline Start Time (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/metrics/buffering/StartupTimeline Returns the precise start time of the application startup timeline. This method is crucial for understanding when the application began its initialization process and is measured with nanosecond precision. ```java public Instant getStartTime() { // Implementation returns the start time } ``` -------------------------------- ### ReactiveWebServerFactoryCustomizer Class Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizer Provides details on the ReactiveWebServerFactoryCustomizer class, its constructors, and methods. ```APIDOC ## Class: ReactiveWebServerFactoryCustomizer ### Description `WebServerFactoryCustomizer` to apply `ServerProperties` to reactive servers. Since: 2.0.0 Author: Brian Clozel, Yunkun Huang, Scott Frederick ### Implements `WebServerFactoryCustomizer`, `Ordered` ### Constructor Summary - **ReactiveWebServerFactoryCustomizer**(ServerProperties serverProperties) Create a new `ReactiveWebServerFactoryCustomizer` instance. - **ReactiveWebServerFactoryCustomizer**(ServerProperties serverProperties, SslBundles sslBundles) Create a new `ReactiveWebServerFactoryCustomizer` instance. Since: 3.1.0 ### Method Summary - **void customize**(ConfigurableReactiveWebServerFactory factory) Customize the specified `WebServerFactory`. - **int getOrder**() Get the order value. Specified by: `getOrder` in interface `Ordered` ### Constructor Details #### ReactiveWebServerFactoryCustomizer(ServerProperties serverProperties) **Description:** Create a new `ReactiveWebServerFactoryCustomizer` instance. **Parameters:** - **serverProperties** (ServerProperties) - the server properties #### ReactiveWebServerFactoryCustomizer(ServerProperties serverProperties, SslBundles sslBundles) **Description:** Create a new `ReactiveWebServerFactoryCustomizer` instance. **Parameters:** - **serverProperties** (ServerProperties) - the server properties - **sslBundles** (SslBundles) - the SSL bundles ### Method Details #### customize(ConfigurableReactiveWebServerFactory factory) **Description:** Customize the specified `WebServerFactory`. **Parameters:** - **factory** (ConfigurableReactiveWebServerFactory) - the web server factory to customize #### getOrder() **Description:** Get the order value. **Returns:** - int - the order value ``` -------------------------------- ### Transaction Template Configuration Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/condition/class-use/ConditionalOnSingleCandidate Configuration for TransactionTemplate, requiring a ReactiveTransactionManager. This setup is conditionally applied. ```java TransactionalOperator TransactionAutoConfiguration.`transactionalOperator(ReactiveTransactionManager transactionManager)` ``` -------------------------------- ### JMS Template Configuration Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/condition/class-use/ConditionalOnSingleCandidate Configuration for JmsTemplate, requiring a ConnectionFactory. This setup is conditionally applied. ```java `JmsTemplate` JmsAutoConfiguration.JmsTemplateConfiguration.`jmsTemplate(ConnectionFactory connectionFactory)` ``` -------------------------------- ### UndertowWebServer Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer Information about how to instantiate an UndertowWebServer. ```APIDOC ## UndertowWebServer Constructors ### `UndertowWebServer(io.undertow.Undertow.Builder builder, boolean autoStart)` **Description:** Create a new `UndertowWebServer` instance. **Parameters:** - `builder` (io.undertow.Undertow.Builder) - Required - The builder for the Undertow server. - `autoStart` (boolean) - Required - Whether the server should be started automatically. ### `UndertowWebServer(io.undertow.Undertow.Builder builder, Iterable httpHandlerFactories, boolean autoStart)` **Description:** Create a new `UndertowWebServer` instance. **Parameters:** - `builder` (io.undertow.Undertow.Builder) - Required - The builder for the Undertow server. - `httpHandlerFactories` (Iterable) - Required - The handler factories to use. - `autoStart` (boolean) - Required - Whether the server should be started automatically. **Since:** 2.3.0 ``` -------------------------------- ### Java: ReactiveWebServerFactoryCustomizer Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizer Demonstrates the constructors for ReactiveWebServerFactoryCustomizer. The first constructor takes ServerProperties, while the second also accepts SslBundles. These are used to initialize the customizer with server configuration. ```java public ReactiveWebServerFactoryCustomizer(ServerProperties serverProperties) Create a new `ReactiveWebServerFactoryCustomizer` instance. Parameters: `serverProperties` - the server properties ``` ```java public ReactiveWebServerFactoryCustomizer(ServerProperties serverProperties, SslBundles sslBundles) Create a new `ReactiveWebServerFactoryCustomizer` instance. Parameters: `serverProperties` - the server properties `sslBundles` - the SSL bundles Since: 3.1.0 ``` -------------------------------- ### Get Docker Compose Start Log Level Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/logging/class-use/LogLevel Retrieves the configured log level for the Docker Compose start operation. This is part of the DockerComposeProperties configuration for managing Docker Compose lifecycle within Spring. ```java LogLevel getLogLevel() ``` -------------------------------- ### Example JUnit Test using GsonTester Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/json/GsonTester An example demonstrating how to use GsonTester in a JUnit test class. It shows the setup for initializing the tester and performing a JSON write assertion against an expected JSON file. ```java public class ExampleObjectJsonTests { private GsonTester json; @Before public void setup() { Gson gson = new GsonBuilder().create(); GsonTester.initFields(this, gson); } @Test public void testWriteJson() throws IOException { ExampleObject object = //...; assertThat(json.write(object)).isEqualToJson("expected.json"); } } ``` -------------------------------- ### Example Usage of JsonbTester - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/json/JsonbTester An example demonstrating how to use JsonbTester within a Spring Boot test class. It shows the setup process using `@Before` and then utilizes the `json.write()` method to assert JSON output against an expected file. ```java public class ExampleObjectJsonTests { private JsonbTester json; @Before public void setup() { Jsonb jsonb = JsonbBuilder.create(); JsonbTester.initFields(this, jsonb); } @Test public void testWriteJson() throws IOException { ExampleObject object = // ... assertThat(json.write(object)).isEqualToJson("expected.json"); } } ``` -------------------------------- ### Spring Boot Core: Starting Event Listener Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/class-use/ConfigurableBootstrapContext Shows the `starting` method of `SpringApplicationRunListener`. This method is called at the very beginning of the application's run process, receiving the bootstrap context. ```java default void starting(ConfigurableBootstrapContext bootstrapContext) { // ... method body ... } ``` -------------------------------- ### Get PropertyMapper Instance in Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/properties/PropertyMapper Retrieves the singleton instance of the PropertyMapper. This is the starting point for performing property mappings within your application. ```java PropertyMapper mapper = PropertyMapper.get(); ``` -------------------------------- ### Create MultipartConfigElement Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/servlet/MultipartConfigFactory Demonstrates how to create a MultipartConfigElement instance using the configured MultipartConfigFactory. ```APIDOC ## GET /multipart/config/create ### Description Creates and returns a new MultipartConfigElement instance based on the current factory configuration. ### Method GET ### Endpoint /multipart/config/create ### Parameters (No parameters, uses existing factory configuration) ### Request Body (Not applicable) ### Response #### Success Response (200) - **multipartConfigElement** (Object) - The created MultipartConfigElement instance. #### Response Example ```json { "multipartConfigElement": { "fileSizeThreshold": "1MB", "location": "/tmp/uploads", "maxFileSize": "10MB", "maxRequestSize": "20MB" } } ``` ``` -------------------------------- ### Configurations Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/annotation/Configurations Details on how to create new Configurations instances. ```APIDOC ## Configurations Constructors ### protected Configurations(Collection> classes) Create a new `Configurations` instance. #### Parameters - **classes** (Collection>) - the configuration classes ### protected Configurations(UnaryOperator>> sorter, Collection> classes, Function,String> beanNameGenerator) Create a new `Configurations` instance. Since: 3.4.0 #### Parameters - **sorter** (UnaryOperator>>) - a `UnaryOperator` used to sort the configurations - **classes** (Collection>) - the configuration classes - **beanNameGenerator** (Function,String>) - an optional function used to generate the bean name ``` -------------------------------- ### Get Registration Description in Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean Returns a description of the registration, for example 'Servlet resourceServlet'. This method is inherited from `RegistrationBean`. ```java protected String getDescription() ``` -------------------------------- ### Instantiator Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/util/Instantiator Provides details on how to create new Instantiator instances. ```APIDOC ## Constructors ### Instantiator `public Instantiator(Class type, Consumer availableParameters)` Create a new `Instantiator` instance for the given type. **Parameters:** - `type` (Class) - the type to instantiate - `availableParameters` (Consumer) - consumer used to register available parameters ### Instantiator `public Instantiator(Class type, Consumer availableParameters, Instantiator.FailureHandler failureHandler)` Create a new `Instantiator` instance for the given type. **Parameters:** - `type` (Class) - the type to instantiate - `availableParameters` (Consumer) - consumer used to register available parameters - `failureHandler` (Instantiator.FailureHandler) - a `Instantiator.FailureHandler` that will be called in case of failure when instantiating objects **Since:** 2.7.0 ``` -------------------------------- ### Get Bean by Name - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert Retrieves a single bean by its name from the application context. Asserts on the bean or null if not found. Throws AssertionError if the context fails to start. ```Java assertThat(context).getBean("foo").isInstanceOf(Foo.class); assertThat(context).getBean("foo").isNull(); ``` -------------------------------- ### Create DefaultSslBundleRegistry Constructor (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/ssl/class-use/SslBundle Provides an example of initializing a DefaultSslBundleRegistry with a given name and an initial SslBundle. This constructor is used for setting up a registry with a starting bundle. ```java new DefaultSslBundleRegistry(name, bundle) ``` -------------------------------- ### Java - Create and Control JettyWebServer Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/jetty/JettyWebServer Demonstrates the creation and basic control operations for a JettyWebServer. This includes instantiating the server with or without auto-start, and methods to start, stop, destroy, and retrieve the server's port. ```java import org.springframework.boot.web.embedded.jetty.JettyWebServer; import org.springframework.boot.web.server.WebServerException; import org.springframework.boot.web.server.GracefulShutdownCallback; import org.eclipse.jetty.server.Server; // ... // Create a Jetty server instance (assuming 'server' is an initialized org.eclipse.jetty.server.Server object) Server jettyServer = new Server(8080); // Create a JettyWebServer instance JettyWebServer webServer = new JettyWebServer(jettyServer, true); // Start the web server try { webServer.start(); System.out.println("Jetty server started on port: " + webServer.getPort()); } catch (WebServerException e) { System.err.println("Failed to start server: " + e.getMessage()); } // Stop the web server webServer.stop(); // Destroy the web server webServer.destroy(); // Gracefully shut down the web server webServer.shutDownGracefully(new GracefulShutdownCallback() { @Override public void completed() { System.out.println("Graceful shutdown completed."); } }); // Get the underlying Jetty Server object org.eclipse.jetty.server.Server underlyingServer = webServer.getServer(); ``` -------------------------------- ### Get Failure - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert Retrieves the failure that prevented the application context from running. Asserts on the failure's message or other properties. Throws AssertionError if the context started without a failure. ```Java assertThat(context).getFailure().containsMessage("missing bean"); ``` -------------------------------- ### ServletContextInitializerConfiguration.configure Method Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/jetty/ServletContextInitializerConfiguration Details and example for the configure method. ```APIDOC ## Method Details ### configure ```java public void configure(org.eclipse.jetty.ee10.webapp.WebAppContext context) throws Exception ``` **Description:** Specified by `configure` in interface `org.eclipse.jetty.ee10.webapp.Configuration`. Overrides `configure` in class `org.eclipse.jetty.ee10.webapp.AbstractConfiguration`. **Throws:** * `Exception` ``` -------------------------------- ### TomcatWebServer Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer Details on how to instantiate and initialize a TomcatWebServer. ```APIDOC ## TomcatWebServer Constructors ### `TomcatWebServer(Tomcat tomcat)` Create a new `TomcatWebServer` instance. **Parameters:** - `tomcat` (Tomcat) - The underlying Tomcat server. ### `TomcatWebServer(Tomcat tomcat, boolean autoStart)` Create a new `TomcatWebServer` instance. **Parameters:** - `tomcat` (Tomcat) - The underlying Tomcat server. - `autoStart` (boolean) - Whether the server should be started automatically. ### `TomcatWebServer(Tomcat tomcat, boolean autoStart, Shutdown shutdown)` Create a new `TomcatWebServer` instance. **Parameters:** - `tomcat` (Tomcat) - The underlying Tomcat server. - `autoStart` (boolean) - Whether the server should be started automatically. - `shutdown` (Shutdown) - The type of shutdown supported by the server. **Since:** - 2.3.0 ``` -------------------------------- ### Get Bean Names by Type Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert Obtains the names of all beans of the specified type from the application context. Returns an array assertion for the bean names. Throws an AssertionError if the application context did not start. ```java assertThat(context).getBeanNames(Foo.class).containsOnly("fooBean"); ``` -------------------------------- ### Configure ApplicationContextRunner with Properties and Configuration Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner This example demonstrates how to initialize an ApplicationContextRunner with specific property values and a custom configuration class. This setup is applied to all subsequent tests. ```java public class MyContextTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withPropertyValues("spring.foo=bar") .withUserConfiguration(MyConfiguration.class); } ``` -------------------------------- ### WarLauncher Methods (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/loader/launch/WarLauncher Details the instance and static methods of the `WarLauncher` class, including `getEntryPathPrefix`, `isLibraryFileOrClassesDirectory`, and `main`. It also notes inherited methods from parent classes. ```java `protected String getEntryPathPrefix() Return the path prefix for relevant entries in the archive. Overrides: `getEntryPathPrefix` in class `Launcher` Returns: the entry path prefix * ### isLibraryFileOrClassesDirectory protected boolean isLibraryFileOrClassesDirectory(Archive.Entry entry) Overrides: `isLibraryFileOrClassesDirectory` in class `Launcher` * ### main public static void main(String[] args) throws Exception Throws: `Exception` ``` ```java ### Methods inherited from class org.springframework.boot.loader.launch.ExecutableArchiveLauncher `createClassLoader, getArchive, getClassPathUrls, getMainClass, isSearchedDirectory` ### Methods inherited from class org.springframework.boot.loader.launch.Launcher `isExploded, isIncludedOnClassPath, isIncludedOnClassPathAndNotIndexed, launch, launch` ### Methods inherited from class java.lang.Object `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait` ``` -------------------------------- ### UndertowWebServer Constructors (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer Provides details on how to instantiate an UndertowWebServer. The constructors allow for initialization with an Undertow builder and options for auto-starting or providing HTTP handler factories. ```Java public UndertowWebServer(io.undertow.Undertow.Builder builder, boolean autoStart) ``` ```Java public UndertowWebServer(io.undertow.Undertow.Builder builder, Iterable httpHandlerFactories, boolean autoStart) ``` -------------------------------- ### Transaction AutoConfiguration Template Configuration Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/condition/class-use/ConditionalOnSingleCandidate Static inner class within TransactionAutoConfiguration, likely related to configuring transaction templates. It's part of the broader transaction management setup. ```java static class TransactionAutoConfiguration.TransactionTemplateConfiguration ``` -------------------------------- ### SpringBootApplication Annotation Example Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/SpringBootApplication This Java code snippet shows the declaration of the @SpringBootApplication annotation. It indicates a configuration class that triggers auto-configuration and component scanning, simplifying Spring Boot application setup. ```java @Target(TYPE) @Retention(RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan(excludeFilters={"@Filter(type=CUSTOM,classes=TypeExcludeFilter.class)"}) public @interface SpringBootApplication ``` -------------------------------- ### Instantiator Methods Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/util/Instantiator Details on various methods for instantiating objects. ```APIDOC ## Method Details ### instantiate `public List instantiate(Collection names)` Instantiate the given set of class name, injecting constructor arguments as necessary. **Parameters:** - `names` (Collection) - the class names to instantiate **Returns:** - a list of instantiated instances ### instantiate `public List instantiate(ClassLoader classLoader, Collection names)` Instantiate the given set of class name, injecting constructor arguments as necessary. **Parameters:** - `classLoader` (ClassLoader) - the source classloader - `names` (Collection) - the class names to instantiate **Returns:** - a list of instantiated instances **Since:** 2.4.8 ### instantiate `public T instantiate(String name)` Instantiate the given set of class name, injecting constructor arguments as necessary. **Parameters:** - `name` (String) - the class name to instantiate **Returns:** - an instantiated instance **Since:** 3.4.0 ### instantiate `public T instantiate(ClassLoader classLoader, String name)` Instantiate the given set of class name, injecting constructor arguments as necessary. **Parameters:** - `classLoader` (ClassLoader) - the source classloader - `name` (String) - the class name to instantiate **Returns:** - an instantiated instance **Since:** 3.4.0 ### instantiateType `public T instantiateType(Class type)` Instantiate the given class, injecting constructor arguments as necessary. **Parameters:** - `type` (Class) - the type to instantiate **Returns:** - an instantiated instance **Since:** 3.4.0 ### instantiateTypes `public List instantiateTypes(Collection> types)` Instantiate the given set of classes, injecting constructor arguments as necessary. **Parameters:** - `types` (Collection>) - the types to instantiate **Returns:** - a list of instantiated instances **Since:** 2.4.8 ### getArg `public A getArg(Class type)` Get an injectable argument instance for the given type. This method can be used when manually instantiating an object without reflection. **Type Parameters:** - `A` - the argument type **Parameters:** - `type` (Class) - the argument type **Returns:** - the argument to inject or `null` **Since:** 3.4.0 ``` -------------------------------- ### Run Docker Compose Up Command Source: https://docs.spring.io/spring-boot/api/java/index-files/index-21 This method, available on the `org.springframework.boot.docker.compose.core.DockerCompose` interface, executes the `docker compose up` command to create and start services defined in a Docker Compose file. It allows for specifying the logging level and optionally a list of services to start. ```java dockerCompose.up(LogLevel.INFO); dockerCompose.up(LogLevel.DEBUG, List.of("service1", "service2")); ``` -------------------------------- ### Java: ReactiveWebServerFactoryCustomizer Methods Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryCustomizer Details the instance methods of ReactiveWebServerFactoryCustomizer. The `getOrder` method returns the order of this customizer, and the `customize` method applies the server properties to the given factory. ```java public int getOrder() Specified by: `getOrder` in interface `Ordered` ``` ```java public void customize(ConfigurableReactiveWebServerFactory factory) Description copied from interface: `WebServerFactoryCustomizer` Customize the specified `WebServerFactory`. Specified by: `customize` in interface `WebServerFactoryCustomizer` Parameters: `factory` - the web server factory to customize ``` -------------------------------- ### Get Default ClientHttpRequestFactorySettings (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/http/client/ClientHttpRequestFactorySettings Provides a method to obtain default settings for ClientHttpRequestFactory. These defaults may vary based on the specific implementation of the HTTP client factory. This is useful for starting with a baseline configuration. ```java public static ClientHttpRequestFactorySettings defaults() ``` -------------------------------- ### Get SslBundle from RedisConnectionDetails - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/ssl/class-use/SslBundle Provides examples of retrieving the SSL bundle from different Redis connection configurations (Cluster, Sentinel, Standalone). This is crucial for securing Redis data access. ```java default SslBundle RedisConnectionDetails.Cluster.getSslBundle() default SslBundle RedisConnectionDetails.Sentinel.getSslBundle() default SslBundle RedisConnectionDetails.Standalone.getSslBundle() ``` -------------------------------- ### ServletContextInitializerConfiguration Constructor Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/jetty/ServletContextInitializerConfiguration Details and example for the ServletContextInitializerConfiguration constructor. ```APIDOC ## Constructor Details ### ServletContextInitializerConfiguration ```java public ServletContextInitializerConfiguration(ServletContextInitializer... initializers) ``` **Description:** Create a new `ServletContextInitializerConfiguration`. **Parameters:** * `initializers` (ServletContextInitializer...) - the initializers that should be invoked **Since:** 1.2.1 ``` -------------------------------- ### Create Specific Client HTTP Connectors with Settings (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/http/client/reactive/class-use/ClientHttpConnectorSettings Illustrates the creation of specialized HTTP connectors (HttpComponents, Jdk, Jetty, Reactor) using ClientHttpConnectorSettings. ```java protected HttpComponentsClientHttpConnector HttpComponentsClientHttpConnectorBuilder.createClientHttpConnector(ClientHttpConnectorSettings settings) ``` ```java protected JdkClientHttpConnector JdkClientHttpConnectorBuilder.createClientHttpConnector(ClientHttpConnectorSettings settings) ``` ```java protected JettyClientHttpConnector JettyClientHttpConnectorBuilder.createClientHttpConnector(ClientHttpConnectorSettings settings) ``` ```java protected ReactorClientHttpConnector ReactorClientHttpConnectorBuilder.createClientHttpConnector(ClientHttpConnectorSettings settings) ``` -------------------------------- ### Get Or Find Configuration Classes Method (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper Retrieves or finds the configuration classes associated with the merged context configuration. This protected method is used internally for test setup. ```java protected Class[] getOrFindConfigurationClasses(MergedContextConfiguration mergedConfig) ``` -------------------------------- ### UndertowReactiveWebServerFactory Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory Provides details on how to create new instances of UndertowReactiveWebServerFactory. ```APIDOC ## Constructor: UndertowReactiveWebServerFactory() ### Description Create a new `UndertowReactiveWebServerFactory` instance. ### Method `public UndertowReactiveWebServerFactory()` ### Parameters None ### Response Example ```json { "message": "Instance created successfully" } ``` ``` ```APIDOC ## Constructor: UndertowReactiveWebServerFactory(port) ### Description Create a new `UndertowReactiveWebServerFactory` that listens for requests using the specified port. ### Method `public UndertowReactiveWebServerFactory(int port)` ### Parameters #### Path Parameters - **port** (int) - Required - The port to listen on. ### Response Example ```json { "message": "Instance created successfully on port: [port]" } ``` ``` -------------------------------- ### Quartz JDBC Store Type Configuration Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/condition/class-use/ConditionalOnSingleCandidate Configuration for Quartz's JDBC store type, part of QuartzAutoConfiguration. This inner class is typically used for specific JDBC-related Quartz setups. ```java protected static class QuartzAutoConfiguration.JdbcStoreTypeConfiguration ``` -------------------------------- ### Spring Boot Startup Endpoint Java Code Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/actuate/startup/StartupEndpoint This Java code defines the `StartupEndpoint` class, an annotation-driven Spring Boot endpoint that exposes the application's startup timeline. It utilizes `BufferingApplicationStartup` to capture startup events and provides methods to retrieve startup descriptors. ```java import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.ImportRuntimeHints; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; import org.springframework.boot.startup.BufferingApplicationStartup; @Endpoint(id="startup") @ImportRuntimeHints(StartupEndpoint.StartupEndpointRuntimeHints.class) public class StartupEndpoint { public StartupEndpoint(BufferingApplicationStartup applicationStartup) { // Constructor implementation } @ReadOperation public StartupEndpoint.StartupDescriptor startupSnapshot() { // Method implementation return null; // Placeholder } @WriteOperation public StartupEndpoint.StartupDescriptor startup() { // Method implementation return null; // Placeholder } // Nested class StartupDescriptor and RuntimeHints class would be defined here public static class StartupDescriptor {} public static class StartupEndpointRuntimeHints {} } ``` -------------------------------- ### Spring Boot Application Availability AutoConfiguration (Java) Source: https://docs.spring.io/spring-boot/api/java/index-files/index-1 Provides auto-configuration for `ApplicationAvailabilityBean`. This class enables the automatic setup of application availability state monitoring when Spring Boot starts. ```java applicationAvailability() - Method in class org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration ApplicationAvailabilityAutoConfiguration - Class in org.springframework.boot.autoconfigure.availability ApplicationAvailabilityAutoConfiguration() - Constructor for class org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration ``` -------------------------------- ### AbstractConnectionFactoryConfigurer Methods Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/amqp/AbstractConnectionFactoryConfigurer Documentation for the methods within AbstractConnectionFactoryConfigurer, including configuration and strategy retrieval. ```APIDOC ## AbstractConnectionFactoryConfigurer Methods ### protected final org.springframework.amqp.rabbit.connection.ConnectionNameStrategy getConnectionNameStrategy() Retrieves the configured connection name strategy. ### public final void setConnectionNameStrategy(org.springframework.amqp.rabbit.connection.ConnectionNameStrategy connectionNameStrategy) Sets the connection name strategy for the connection factory. **Parameters:** - `connectionNameStrategy` (org.springframework.amqp.rabbit.connection.ConnectionNameStrategy) - The strategy to set. ### public final void configure(T connectionFactory) Configures the given `connectionFactory` with sensible defaults. **Parameters:** - `connectionFactory` (T) - The connection factory to configure. ### protected abstract void configure(T connectionFactory, RabbitProperties rabbitProperties) Configures the given `connectionFactory` using the given `rabbitProperties`. **Parameters:** - `connectionFactory` (T) - The connection factory to configure. - `rabbitProperties` (RabbitProperties) - Properties to use for the configuration. ``` -------------------------------- ### ErrorPage Methods for Retrieving Information in Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/server/ErrorPage Provides examples of methods used to retrieve details about an `ErrorPage` configuration. These include getting the associated exception type, path, and HTTP status code. ```java public String getPath() public Class getException() public HttpStatus getStatus() public int getStatusCode() public String getExceptionName() public boolean isGlobal() ``` -------------------------------- ### JobLauncherApplicationRunner API Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner Documentation for the JobLauncherApplicationRunner class, including its constructor, fields, and methods for launching Spring Batch jobs. ```APIDOC ## JobLauncherApplicationRunner ### Description Provides functionality to launch Spring Batch jobs programmatically. ### Constructor Details #### JobLauncherApplicationRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository) * **Description**: Creates a new `JobLauncherApplicationRunner`. * **Parameters**: * `jobLauncher` (org.springframework.batch.core.launch.JobLauncher) - to launch jobs * `jobExplorer` (org.springframework.batch.core.explore.JobExplorer) - to check the job repository for previous executions * `jobRepository` (org.springframework.batch.core.repository.JobRepository) - to check if a job instance exists with the given parameters when running a job ### Field Details #### DEFAULT_ORDER * **Description**: The default order for the command line runner. * **Type**: `int` * **Access**: `public static final` ### Method Details #### afterPropertiesSet() * **Description**: Callback to perform initialization after all bean properties have been set. * **Method**: `void` * **Implements**: `InitializingBean` #### validate() * **Description**: Deprecated method for validation. Subject to removal in a future version. * **Method**: `void` * **Deprecated**: `since="3.0.10", forRemoval=true` #### setOrder(int order) * **Description**: Sets the order of this runner. * **Method**: `void` * **Parameters**: * `order` (int) - the order value #### getOrder() * **Description**: Gets the order of this runner. * **Method**: `int` * **Implements**: `Ordered` #### setApplicationEventPublisher(ApplicationEventPublisher publisher) * **Description**: Sets the `ApplicationEventPublisher`. * **Method**: `void` * **Implements**: `ApplicationEventPublisherAware` * **Parameters**: * `publisher` (ApplicationEventPublisher) - the publisher to set #### setJobRegistry(@Autowired(required=false) org.springframework.batch.core.configuration.JobRegistry jobRegistry) * **Description**: Sets the `JobRegistry`. * **Method**: `void` * **Parameters**: * `jobRegistry` (org.springframework.batch.core.configuration.JobRegistry) - the job registry to set #### setJobName(String jobName) * **Description**: Sets the name of the job to be launched. * **Method**: `void` * **Parameters**: * `jobName` (String) - the job name #### setJobParametersConverter(@Autowired(required=false) org.springframework.batch.core.converter.JobParametersConverter converter) * **Description**: Sets the `JobParametersConverter`. * **Method**: `void` * **Parameters**: * `converter` (org.springframework.batch.core.converter.JobParametersConverter) - the converter to set #### setJobs(@Autowired(required=false) Collection jobs) * **Description**: Sets a collection of jobs to be launched. * **Method**: `void` * **Parameters**: * `jobs` (Collection) - the collection of jobs #### run(ApplicationArguments args) * **Description**: Callback used to run the bean with provided application arguments. * **Method**: `void` * **Throws**: `Exception` - on error * **Implements**: `ApplicationRunner` * **Parameters**: * `args` (ApplicationArguments) - incoming application arguments #### run(String... args) * **Description**: Runs the job with the given arguments. * **Method**: `void` * **Throws**: `org.springframework.batch.core.JobExecutionException` * **Parameters**: * `args` (String...) - the arguments for the job #### launchJobFromProperties(Properties properties) * **Description**: Launches a job using properties. * **Method**: `protected void` * **Throws**: `org.springframework.batch.core.JobExecutionException` * **Parameters**: * `properties` (Properties) - the properties to configure the job launch #### execute(org.springframework.batch.core.Job job, org.springframework.batch.core.JobParameters jobParameters) * **Description**: Executes a specific job with given parameters. * **Method**: `protected void` * **Throws**: * `org.springframework.batch.core.repository.JobExecutionAlreadyRunningException` * `org.springframework.batch.core.repository.JobRestartException` * `org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException` * `org.springframework.batch.core.JobParametersInvalidException` * **Parameters**: * `job` (org.springframework.batch.core.Job) - the job to execute * `jobParameters` (org.springframework.batch.core.JobParameters) - the parameters for the job execution ``` -------------------------------- ### Bind Handler: On Start (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/properties/source/class-use/ConfigurationPropertyName Callback method invoked when binding of an element begins, before any result has been determined. It allows for setup or initial checks before the binding process proceeds. ```java Bindable AbstractBindHandler.onStart(ConfigurationPropertyName name, Bindable target, BindContext context) ``` ```java default Bindable BindHandler.onStart(ConfigurationPropertyName name, Bindable target, BindContext context) ``` -------------------------------- ### Java: Get Port from PortInUseException Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/server/PortInUseException Shows how to retrieve the port number that caused the PortInUseException. This method is useful for logging or user feedback when an application fails to start due to a port conflict. ```java int port = exception.getPort(); ``` -------------------------------- ### Launch Application with Arguments - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/loader/launch/Launcher Launches the Spring Boot application using the provided arguments. This method serves as the initial entry point for subclasses' main methods. ```java protected void launch(String[] args) throws Exception ``` -------------------------------- ### build Methods Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/builder/SpringApplicationBuilder Methods to build a fully configured SpringApplication. ```APIDOC ## build Methods ### `build()` Returns a fully configured `SpringApplication` that is ready to run. * **Returns:** `SpringApplication` - The fully configured `SpringApplication`. ### `build(String... args)` Returns a fully configured `SpringApplication` that is ready to run. Any parent that has been configured will be run with the given `args`. * **Parameters:** * `args` (String...) - The parent's args. * **Returns:** `SpringApplication` - The fully configured `SpringApplication`. ``` -------------------------------- ### RunProcess Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/loader/tools/RunProcess Details on how to create instances of the RunProcess class. ```APIDOC ## RunProcess Constructors ### `RunProcess(String... command)` Creates a new `RunProcess` instance for the specified command. **Parameters:** * `command` (String...) - The program to execute and its arguments. ### `RunProcess(File workingDirectory, String... command)` Creates a new `RunProcess` instance for the specified working directory and command. **Parameters:** * `workingDirectory` (File) - The working directory of the child process or `null` to run in the working directory of the current Java process. * `command` (String...) - The program to execute and its arguments. ``` -------------------------------- ### Get SSL Certificate Validity Information - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/info/SslInfo Retrieves the validity information of the SSL certificate, including start and end dates. This method is part of the SslInfo.CertificateInfo class in Spring Boot and returns a CertificateValidityInfo object. ```java public SslInfo.CertificateValidityInfo getValidity() ``` -------------------------------- ### ApplicationPidFileWriter Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/ApplicationPidFileWriter Provides details on how to instantiate the ApplicationPidFileWriter. ```APIDOC ## ApplicationPidFileWriter Constructors ### `ApplicationPidFileWriter()` Creates a new `ApplicationPidFileWriter` instance using the default filename 'application.pid'. ### `ApplicationPidFileWriter(String filename)` Creates a new `ApplicationPidFileWriter` instance with a specified filename. **Parameters:** - **filename** (String) - The name of the file where the PID will be written. ### `ApplicationPidFileWriter(File file)` Creates a new `ApplicationPidFileWriter` instance with a specified file object. **Parameters:** - **file** (File) - The file object where the PID will be written. ``` -------------------------------- ### Handle ApplicationContext Startup Failures with Assertions Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner This example illustrates how to handle cases where the ApplicationContext fails to start. It uses the `run` method and asserts that the failure cause is of a specific exception type. ```java @Test public someTest() { this.context.withPropertyValues("spring.foo=fails").run((loaded) -> { assertThat(loaded).getFailure().hasCauseInstanceOf(BadPropertyException.class); // other assertions }); } ``` -------------------------------- ### run Method Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/builder/SpringApplicationBuilder Creates and runs an application context with the provided command line arguments. ```APIDOC ## run ### Description Create an application context (and its parent if specified) with the command line args provided. The parent is run first with the same arguments if it has not yet been started. ### Method `public ConfigurableApplicationContext run(String... args)` ### Parameters * `args` (String...) - The command line arguments. ### Returns `ConfigurableApplicationContext` - An application context created from the current state. ``` -------------------------------- ### Get Skip Status - Java Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/docker/compose/lifecycle/class-use/DockerComposeProperties.Start Retrieves the skip status for Docker Compose start operations. This method is part of the DockerComposeProperties.Start class and returns an enum value indicating whether the operation should be skipped. ```java DockerComposeProperties.Start.Skip DockerComposeProperties.Start.getSkip() ``` -------------------------------- ### PemSslStoreBundle Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/ssl/pem/PemSslStoreBundle Details on how to create instances of PemSslStoreBundle. ```APIDOC ## PemSslStoreBundle Constructors ### Description Constructors for creating `PemSslStoreBundle` instances. ### Constructor Summary | Constructor | | -------------------------------------------------------------------------- | | `PemSslStoreBundle(PemSslStoreDetails keyStoreDetails, PemSslStoreDetails trustStoreDetails)` | | `PemSslStoreBundle(PemSslStore pemKeyStore, PemSslStore pemTrustStore)` | ### Constructor Details #### PemSslStoreBundle(PemSslStoreDetails keyStoreDetails, PemSslStoreDetails trustStoreDetails) ##### Description Creates a new `PemSslStoreBundle` instance using provided key store and trust store details. ##### Parameters - **keyStoreDetails** (PemSslStoreDetails) - The key store details. - **trustStoreDetails** (PemSslStoreDetails) - The trust store details. #### PemSslStoreBundle(PemSslStore pemKeyStore, PemSslStore pemTrustStore) ##### Description Creates a new `PemSslStoreBundle` instance using provided PEM key store and trust store objects. ##### Parameters - **pemKeyStore** (PemSslStore) - The PEM key store. - **pemTrustStore** (PemSslStore) - The PEM trust store. ##### Since 3.2.0 ``` -------------------------------- ### Get and Set StartCommand in DockerComposeProperties Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/docker/compose/lifecycle/class-use/StartCommand This snippet illustrates how to access and modify the Docker Compose start command within the `DockerComposeProperties.Start` configuration. It shows the getter and setter methods for the `command` property, which is of type `StartCommand`. ```java StartCommand command = dockerComposeProperties.getStart().getCommand(); dockerComposeProperties.getStart().setCommand(StartCommand.REBUILD); ``` -------------------------------- ### Shutdown Enum Operations (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/web/server/class-use/Shutdown Provides examples of common operations on the `Shutdown` enum, including retrieving enum constants by name and getting all declared constants. These are utility methods for working with the enum. ```java // Getting a Shutdown enum constant by name Shutdown specificShutdown = Shutdown.valueOf("GRACEFUL"); // Getting all Shutdown enum constants Shutdown[] allShutdowns = Shutdown.values(); ``` -------------------------------- ### PlatformPlaceholderDatabaseDriverResolver Constructors Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/jdbc/init/PlatformPlaceholderDatabaseDriverResolver Provides details on how to instantiate the PlatformPlaceholderDatabaseDriverResolver. ```APIDOC ## PlatformPlaceholderDatabaseDriverResolver() ### Description Creates a new resolver that will use the default `"@@platform@@"` placeholder. ### Method `public` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "new PlatformPlaceholderDatabaseDriverResolver()" } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` ```APIDOC ## PlatformPlaceholderDatabaseDriverResolver(String placeholder) ### Description Creates a new resolver that will use the given `placeholder`. ### Method `public` ### Endpoint N/A ### Parameters #### Path Parameters - **placeholder** (String) - Required - The placeholder to use. ### Request Example ```json { "example": "new PlatformPlaceholderDatabaseDriverResolver('custom_placeholder')" } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### Get Non-Prefixed Value of ConfigDataLocation (Java) Source: https://docs.spring.io/spring-boot/api/java/org/springframework/boot/context/config/ConfigDataLocation This Java code example uses the 'getNonPrefixedValue' method to obtain the location string with a specified prefix removed. If the prefix is not present, the original value is returned. ```java import org.springframework.boot.context.config.ConfigDataLocation; // ... ConfigDataLocation location = ConfigDataLocation.of("file:/path/to/config.properties"); String nonPrefixed = location.getNonPrefixedValue("file:"); System.out.println("Non-prefixed value: " + nonPrefixed); // Output: /path/to/config.properties ```