Category Archives: Spring Boot

CAN YOU CONTROL LOGGING WITH SPRING BOOT? HOW?

Can you control logging with Spring Boot? How?

Yes, we can control logging with spring boot.

Customizing default Configuration for Logging:

By adding logback.xml file to the application we can override the default logging configuration by providing the Spring Boot. This file isplaced in the classpath (src/main/resources) of the application for Spring Boot to pick the custom configuration.

Spring Boot can control the logging level

  • Just set it in application.properties
  • Works with most logging frameworks
  • Java Util Logging, Logback, Log4J, Log4J2

logging.level.org.springframework=DEBUG
logging.level.com.acme.your.code=INFO

WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF USING SPRING BOOT?

What are the advantages and disadvantages of using Spring Boot?

Advantages:

  • It is very easy to develop Spring Based applications with Java or Groovy.
  • It reduces a lot of development time and increases productivity.
  • It avoids writing of boilerplate Code, Annotations and XML Configuration.
  • It is very easy to integrate Spring Boot Application with its Spring Ecosystem like Spring JDBC, Spring ORM, Spring Data, Spring Security etc.
  • It follows “Opinionated Defaults Configuration” Approach to reduce Developer effort
  • It provides Embedded HTTP servers like Tomcat, Jetty etc. to develop and test our web applications very easily.
  • It provides CLI (Command Line Interface) tool to develop and test Spring Boot (Java or Groovy) Applications from command prompt very easily and quickly.
  • It provides lots of plugins to develop and test Spring Boot Applications and it uses Build Tools like Maven and Gradle
  • It provides lots of plugins to work with embedded and in-memory Databases very easily.

Disadvantages:

It is very tough and time consuming process to convert existing or legacy Spring Framework projects into Spring Boot Applications. It is applicable only for brand new/Greenfield Spring Projects.

WHAT ARE THE ADVANTAGES OF SPRING BOOT?

What are the advantages of Spring Boot?

  • Reduce Development, Testing time and efforts.
  • Use of JavaConfig helps avoid usage of XML.
  • Avoid lots of maven imports and the various version conflicts.
  • Provide Opinionated Development approach.
  • Quick start to development by providing defaults.
  • No Separate Web Server Needed.Which means that you no longer have to boot up Tomcat, Glassfish, or anything else.
  • Requires less configuration-Since there is no web.xml file. Simply add classes annotated with@Configuration and then you can add methods annotated with@Bean, and Spring will automagically load up the object and manage it like it always has. You can even add Autowired to the bean method to have Spring autowire in dependencies needed for the bean.