1.what is Spring Boot?
Spring Boot is a framework built on top of Spring Framework that simplifies the development of Java-based web applications and microservices. It eliminates the need for complex configurations and allows developers to quickly build and deploy applications with minimal setup.
2.key points of Spring
Spring Boot β Key Points π
β
Built on Spring Framework β Simplifies Java web and microservices development.
β
Auto-configuration β Reduces manual setup, configures beans automatically.
β
Embedded Servers β Comes with Tomcat, Jetty, or Undertow, no need for external servers.
β
Spring Boot Starters β Pre-configured dependencies for faster development.
β
Microservices Support β Ideal for cloud-based applications.
β
Spring Boot Actuator β Provides monitoring, metrics, and health checks.
β
Production-Ready β Has logging, exception handling, and security features.
β
Spring Initializr β Generates a project setup quickly (start.spring.io).
β
Simplified Deployment β Can be packaged as a JAR and run independently.
Example program
package com.example.demo;
import org.springframework.stereotype.Component;
@Component
public class Engine {
// String fuel1, fuel2;
// public Engine(String fuel1, String fuel2)
// {
// this.fuel1 = fuel1;
// this.fuel2 = fuel2;
// }
public void Start() {
System.out.println("Engine Started");
}
}
package com.example.demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Car {
@Autowired
Engine engine;
public static void main(String[] args) {
// Car maruti = new Car();
// maruti.drive();
}
public void drive() {
// TODO Auto-generated method stub
// Engine engine = new Engine("Petrol");
engine.Start();
}
}
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
ConfigurableApplicationContext cac=
SpringApplication.run(DemoApplication.class, args);
Car Bezn = cac.getBean(Car.class);
Bezn.drive();
}
}
Output
. ____ _ __ _ _
/\ / ' __ _ ()_ __ __ _ \ \ \ \
( ( )_ | '_ | '| | ' \/ ` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
' |__| .|| ||| |_, | / / / /
=========||==============|_/=////
:: Spring Boot :: (v3.4.4)
2025-04-03T18:18:10.927+05:30 INFO 10662 --- [demo] [ restartedMain] com.example.demo.DemoApplication : Starting DemoApplication using Java 21.0.6 with PID 10662 (/home/neelakandan/Documents/workspace-spring-tool-suite-4-4.29.1.RELEASE/demo/target/classes started by neelakandan in /home/neelakandan/Documents/workspace-spring-tool-suite-4-4.29.1.RELEASE/demo)
2025-04-03T18:18:10.930+05:30 INFO 10662 --- [demo] [ restartedMain] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default"
2025-04-03T18:18:10.973+05:30 INFO 10662 --- [demo] [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2025-04-03T18:18:10.973+05:30 INFO 10662 --- [demo] [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2025-04-03T18:18:11.812+05:30 INFO 10662 --- [demo] [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2025-04-03T18:18:11.824+05:30 INFO 10662 --- [demo] [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2025-04-03T18:18:11.824+05:30 INFO 10662 --- [demo] [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.39]
2025-04-03T18:18:11.850+05:30 INFO 10662 --- [demo] [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2025-04-03T18:18:11.851+05:30 INFO 10662 --- [demo] [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 876 ms
2025-04-03T18:18:12.163+05:30 INFO 10662 --- [demo] [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2025-04-03T18:18:12.183+05:30 INFO 10662 --- [demo] [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2025-04-03T18:18:12.192+05:30 INFO 10662 --- [demo] [ restartedMain] com.example.demo.DemoApplication : Started DemoApplication in 1.585 seconds (process running for 1.88)
Engine Started
Top comments (0)