Why Spring Boot?
Why spring boot was introduced when we had all the comforts of frameworks spring like mvc,hibernate etcSetting up the traditional Spring MVC framework includes
Adding Internal View Resolvers
Setting up Hibernate Session Factory
Connection to Database etc
Sample Code of Component scan and internal view resolver in tradition mvc approach is as shown below
<context:component-scan base-package="com.example.spring.dao"></context:component-scan>
<context:component-scan base-package="com.example.spring.controllers"></context:component-scan>
<context:component-scan base-package="com.example.spring.services"></context:component-scan>
<mvc:annotation-driven/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsps/" />
<property name="suffix" value=".jsp" />
</bean>
Above Code is replaced in just two lines in spring boot using Annotations.
Annotations are widely used in spring boot,All the configurations are replaced by single line annotations, so that the developer can concentrate on business logic rather than spending more time on configuring.
We will see how single line annotations can replace the traditional xml in chapter "Annotations".
0 comments:
Post a Comment