Ans: Spring Boot is a brand new framework from the team at Pivotal, designed to simplify the bootstrapping and development of a new Spring application. The framework takes an opinionated approach to configuration, freeing developers from the need to define boilerplate configuration. In that, Boot aims to be a front-runner in the ever-expanding rapid application development space
Ans: Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.
Ans: Spring Boot Actuator is used by Spring Boot Framework to provide “Management EndPoints” to see Application Internals, Metrics etc
Ans: Spring Data’s mission is to provide a familiar and consistent, Spring-based programming model for data access while still retaining the special traits of the underlying data store. It makes it easy to use data access technologies, relational and non-relational databases, map-reduce frameworks, and cloud-based data services.
Ans: Spring Boot Starters are just JAR Files. They are used by Spring Boot Framework to provide “Auto-Dependency Resolution”.
Ans: Spring Boot AutoConfigurator is used by Spring Boot Framework to provide “Auto-Configuration”.
Ans: Spring Boot Framework has the following components:
Ans: In simple words, Spring Boot CLI is Auto Dependency Resolution, Auto-Configuration, Management EndPoints, Embedded HTTP Servers(Jetty,Tomcat etc.) and (Groovy,Auto-Imports)
Ans: Spring Boot Initilizr is a Spring Boot tool to bootstrap Spring Boot or Spring Applications very easily.
Spring Boot Initilizr comes in the following forms:
Ans: Spring Data REST can be used to expose HATEOAS RESTful resources around Spring Data repositories.
An example using JPA is shown below
@RepositoryRestResource(collectionResourceRel = "todos", path = "todos")
public interface TodoRepository
extends PagingAndSortingRepository<Todo, Long> {
Without writing a lot of code, we can expose RESTful API around Spring Data Repositories.
Ans:
Ans: Think about what you would need to be able to deploy your application (typically) on a virtual machine.
Ans:
Ans: @RepositoryRestResource(collectionResourceRel = "users", path = "users")
public interface UserRestRepository extends
PagingAndSortingRepository<User, Long>
Ans: Spring Boot also provides other starter projects including the typical dependencies to develop specific type of applications
Ans: Spring Boot aims to enable production ready applications in quick time. Spring Boot provides a few non functional features out of the box like caching, logging, monitoring and embedded servers.
Ans: Spring Boot 2.0 requires Java 8 or later. Java 6 and 7 are no longer supported.
Ans: The problem with Spring and Spring MVC is the amount of configuration that is needed. <bean>
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<mvc:resources mapping="/webjars/**" location="/webjars/"/>
Can we bring more intelligence into this? When a spring mvc jar is added into an application, can we auto configure some beans automatically?
Spring Boot looks at a) Frameworks available on the CLASSPATH b) Existing configuration for the application. Based on these, Spring Boot provides basic configuration needed to configure the application with these frameworks. This is called Auto Configuration.
Ans: If you are using Eclipse IDE, Eclipse maven plugin ensures that as soon as you add a dependency or make a change to the class file, it is compiled and ready in the target folder! And after that its just like any other Java application.
When you launch the java application, then the spring boot auto configuration magic kicks in.
Ans: Good news is you can customise it. Click the link “Switch to the full version.“. You would be able to configure the package name you would want!
Ans: Short Story
When we use JPA, we use the annotation and interfaces from javax.persistence package, without using the hibernate import packages.
We recommend using JPA annotations as we are not tied to Hibernate as implementation. Later (I know - <1% Chance), we can use another JPA implementation.
Ans: spring-boot-maven-plugin provides a few commands which enable you to package the code as a jar or run the application
Ans: We recommend managing transactions in the Service layer. Logic for business transactions is in the business/service layer and you would want to enforce transaction management at that level
Ans: We think Spring Data Rest is Good for quick prototyping! Be cautious about using this in Big applications!
With Spring Data REST you are exposing your database entitities directly as REST Services.
When you design RESTful services, Best design practices suggests that your interface should consider two important things
With Spring Data REST, you are not considering either of those. You just expose entities as REST Services.
Thats why we suggest to use it for quick prototyping or the initial evolution of a project. It may not be a great idea for a fully evolved project.