Does spring boot come in to picture only while creating the project? - spring-boot

I've been learning spring boot for a while and as per my understanding, we use spring boot only to create the project along with dependencies and embedded servers. It doesn't have much of a role while working on the project or after the project is created.
I mean, if i were to work on an enterprise application for a company, chances are that, there is already a project created using springboot and I don't have to really use spring boot anywhere while working on that project.
Is my understanding correct?
I've tired googling, but did not find a clear answer.

No. You may still need to use the following spring-boot features after creating a project :
Externalise the application properties
Test the application using testing utilities and annotations provided by spring-boot
Use its auto-configuration feature to quickly configure if you need to enhance your application with other library/framework afterwards.
Use its developer tool to make you have a better Dev experience (e.g automatic restart the app when code changes , hot-reload static content etc.)
Use Actuator to monitor your application health and gather metrics.

I mean, if i were to work on an enterprise application for a company, chances are that, there is already a project created using springboot and I don't have to really use spring boot anywhere while working on that project.
I think you can say pretty much the same about any framework out there. I can't agree with this statement in general.
Every framework (including spring boot) provides a set of features that you may opt to use or not to use in your project.
So yes, for each existing microservice you'll have a #SpringBootApplication class.
Also probably set of configurations / practices how to work with configurations.
You'll already have also spring beans on existing project.
However software constantly evolves (otherwise it doesn't make sense to hire programmers, you know).
So when you (as a new employee) need to create a new micro service then, congratulations, you're using Spring boot features.
Other day-to-day tasks include (just a couple of example out of the head):
Create Integration Tests (#SpringBootTest)
Define new configuration Properties
Use Actuator
Use Metrics + define new metrics
Reconfigure Logging
Writing Liquidbase/Flyway migrations
Integrate new set of beans (Configurations)
Use Autoconfigurations
and so on and so forth.
If you want to really understand what you're doing while implementing these tasks you should know how do relevant features provided by spring boot work.

Related

I am developing a website I know bootstrap and learned spring I want to know what else can be done to make it better?

I want to know what spring dependencies should I use on my website to make the work easy and spring or spring boot which one is better. also, suggest some frontend technologies that I can use to make the website smart.
It's a very broad question. And it all depends on what features you want in your web site. Just listing few basic module to give you some hints.
Spring MVC - For web application with MVC Pattern
Spring Security - To secure your app
Spring ORM - If using any ORM tool like hibernate
You need to explore more on the basis of your need.
Spring Boot vs Spring:
You should use Spring Boot if you are starting new project. Spring Boot came to make development process easier when using Spring Framework. In Spring, developer had to write lots of code to configure beans and dependencies. Spring Boot automated this process so that you no longer do it by yourself but Spring Boot will take care of it. Plus it provides some extra tools (In built Web Server, in Memory DB, tool to monitor and manage Spring Boot App )
Try to create a simple web app in Spring and Spring Boot to understand the difference.
Front-end Technologies:
JavaScript based framework/lib like Angular,React,Vue etc. are the trend for front-end now a days. Again there are pros and cons of each of them. Hence you need to evaluate, what suits you better as per your requirement.

Is it necessary to use a spring initializr for creating spring applications?

I have started learning about spring and in every tutorial they start from spring initializr, i was wondering is it necessary to use it or we can create a project without using spring initializr ?
No, it is no necessary. You can do everything by your own hands. It just helps you to start quicker so that you focus more on the Spring concepts instead of spending much time on "infrastructure" like configuring dependencies. You run it and it just works. Then you can extend it step by step. This can be especially helpful if you just start learning Spring. Later on you should of course spend some time on other aspects that initializr provides you.
Adding to whatever is already mentioned.
No , it is not necessary to create a project with Spring Initializr
The site provides a curated list of dependencies that you can add to
your application based on the selected Spring Boot version. You can
also choose the language, build system and JVM version for the
project.
https://spring.io/blog/2019/02/20/what-s-new-with-spring-initializr.
https://github.com/spring-io/initializr/
Using Spring Initializr the right dependencies are preconfigured for the Spring Boot version used. These preconfigured projects reduces the setup time and one can start implementing the code rather than investing time on which dependencies to go with.

Convert project from Spring framework to Spring boot

I have a set of projects in Spring framework and I have to Find the ones which can be converted to Spring boot.
Is there anything that is related to Spring framework and cannot be converted to spring boot ? In my research, I Could not Find something like that.
But does anyone know something, like a dependency, which would force the project to stay in Spring framework ?
Spring Boot uses the Spring Framework as a foundation and improvises on it. It simplifies Spring dependencies and runs applications straight from a command line. Spring Boot provides several features to help manage enterprise applications easily. Spring Boot is not a replacement for the Spring, but it’s a tool for working faster and easier on Spring applications. It simplifies much of the architecture by adding a layer that helps automate configuration and deployment while making it easier to add new features.
Most of the changes for migrating Spring Framework application to Spring Boot are related to configurations.This migration will have minimal impact on the application code or other custom components.Spring Boot brings a number of advantages to the development.
It simplifies Spring dependencies by taking the opinionated view.
Spring Boot provides a preconfigured set of technologies/framework to reduces error-prone configuration so we as a developer focused on building our business logic and not thinking of project setup.
You really don’t need those big XML configurations for your project.
Embed Tomcat, Jetty or Undertow directly.
Provide opinionated Maven POM to simplify your configurations.
Application metrics and health check using actuator module.
Externalization of the configuration files.
Good to refer this for migrating from Spring to Spring Boot application: https://www.javadevjournal.com/spring-boot/migrating-from-spring-to-spring-boot/

What is meant by Spring boot follows “Opinionated Defaults Configuration” Approach?

I have just started learning spring boot . In its official page I found out this term and I did not understand that what actually it meant in Spring boot context.
Spring Boot just decides on a set of default configured beans which you can override if you want.
For example if you include the spring boot starter pom for jpa, you'll get autoconfigured for you an in memory database, a hibernate entity manager, and a simple datasource. This is an example of an opinionated (Spring's opinion that it's a good starting point) default configuration that you can override.
See https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-replacing-auto-configuration
Spring Boot, is Spring on steroids if you will. It's a great way to get started very quickly with almost the entire Spring stack. I'll try to summarize as what "Opinionated Defaults Configuration" would mean in practice from a programmer's perspective below:
Helps you to setup a fully working application(web app or otherwise) very quickly by providing you intelligent default configurations that you are most likely to be satisfied to start with.
It does so by something called "AutoConfiguration", where capabilities from the Spring ecosystem of products are "auto-magically" enabled in your application by adding certain dependencies to your classpath; adding such dependencies via maven or gradle is super easy.
Most auto-configuration respects your own configuration, and backs off silently if you have provided your own configuration via your own beans.
You would benefit most if you take the java config approach of configuring your Spring application.
Super silky integration of new capabilities in your application by developing your own auto-configuration components (via annotations!).
Tons of auto-configaration components available ranging from Databases(h2, derby etc.), servlet containers(tomact, jetty etc.) to email and websockets are available. It is easy to develop your own. The important thing is that others can use those technology enablements in their own components. Please feel free to contribute.
Helps write very clean code with all the heavy lifting taken care of you, so that you can focus more on your business logic.
Hope you have fun with Spring Boot; its absolutely among the very best of frameworks to have hit the market in the last decade or so.
It follows opinionated default configuration so it reduces the developer efforts. Spring boot always uses sensible opinions, mostly based on the class path contents. So it overrides the default configuration.

Spring boot + Activiti explorer

Is it possible to integrate activiti explorer maven plugin with activiti Spring boot app?, so that we can make use of activit-explorer to view deployed process in activit-spring boot engine.
I know we can use rest-api over spring boot to query process engine, but I want to know if it is possible to run the explorer over spring boot by adding it as a maven plugin during deployment?Or can we tweak the activit-explorer.war somehow to point to spring-boot activiti engine?
activiti-explorer.war is standalone webapp by itself. I've write some guideline on how to manually to embed activiti-explorer to you own app. http://blog.canang.com.my/2016/05/12/embedding-activiti-explorer-to-your-application/
Most probably step 5 in my blog is your solution.
btw, there's reason why the name is 'default'. I can't recall it atm
I thought of answering my own question so that it will be useful for other developers with similar requirement. If you want to make an eco-system where activiti-rest, explorer and your custom end points co-exist, please refer this thread from activit forum. I have tried this and is working fine. link to thread
I would like to give my observation here. In order to avoid getting into pulling source and trying to build myself, I achieved partial success, by installing the activit-explorer as part of the usual standalone installation.Started the standalone activiti-explorer using Apache-Tomcat but I configured the database for Activiti as same as (MYSQL in my case) I used in my spring-boot application to hit the common ground.
But apparently the activiti version in my spring boot app was 5.19.0.0 and that for activiti-explorer was 5.22.0.0, which created some misalignment for spring boot application startup to fail. I am hopeful that with matching versions it might succeed. When I get some more time on me I will try and update. Since then may be someone can use this route.

Resources