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

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.

Related

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/

Spring or Spring boot

As part of a new web application project, I'm planning to learn Spring. I started to read through the Spring framework reference. While I was googling, I came across Spring boot. What I understood is that spring boot helps to build application much faster than spring by reducing configuration. Now I'm little confused whether should I continue learning spring or jump to spring boot. My intention is to understand how spring works as a framework rather than a few features. So please let me know, as a beginner what should I do? First, learn Spring and then spring boot or vice-versa.
Update
Ok, I know it's a while since I asked this question. I kind of have an answer (personal one)
I started with Spring Boot and so far built one Spring Boot REST application. Yes, as others said, Spring Boot, helps you to get started quickly and being new to some language/technology, I would love to see a working module ASAP. So Spring boot helps you with that.
Later depending on your interest, you can start exploring in-depth how Spring boot does that magic.
So, in summary, go with Spring Boot and then deep dive to understand the underlying concept. Again this is my opinion.
Thanks, everyone for your inputs/suggestions.
If you want to develop web applications especially micro-services, I will recommend that you should learn Spring Boot first.
The first reason is that there are many resources and examples on
web, so you can easily find what you need.
The second reason is that Spring Framework (including Spring Boot) is
suitable for PaaS environment especially Pivotal. Therefore you can
rapidly deploy your applications without too much effort.
First of all, learn how Spring applications work.
Spring applications are based on the Object Relation Model. You need to understand the annotations and why we use them. Then you have to learn how Spring MVC works. Up to here, both Spring and Spring Boot are similar. Basically, Spring Boot is made so that a Spring-based application can be made very easily. Spring Boot is very good framework for the Web and other.
After learning the above things, then you can jump easily onto Spring Boot. However, if you jump directly to Spring Boot you will see there are many such things which are not described in the Spring Boot tutorials, since many of them expect that you have some prior knowledge of Spring.

Spring MVC vs Java EE

So I'm about to learn Spring MVC. But what I don't understand is why should I use Spring MVC if I can implement the MVC pattern using a single servlet conroller and JSPs? What advantages does Spring MVC provide over simple java MVC pattern?
Actually yes, you can do it. Question is if you should do it. Spring MVC gives you better organization of your code.
Pure MVC Frameworks like Spring MVC are obsolete today. When combined with templating engines like Thymeleaf, it lacks functionality and developers usually reinvent JSF. For single-page apps based on some popular JS frameworks that need REST backend, JAX-RS is way cleaner and better than Spring MVC REST.
So no, today you don't need Spring MVC and can stick with pure Java EE. For simple, toy-like applications where servlets are enough, you don't really need it but it may be better to use it. For anything serious, MVC is outdated and Spring has nothing to offer.
Edit 2017: Spring offers JAX-RS integration. However, it has several pitfalls, for example Spring won't automatically register classes annotated with #Path for you. Details can be found in Dzone Article
The best way to realize that it's better to play with these technologies for yourself, if you want to try spring MVC I recommend you start with spring boot because you can create projects with more agility without configuring xml files
Spring Boot
Some Features
Create stand-alone Spring applications
Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
Provide opinionated 'starter' POMs to simplify your Maven configuration
Automatically configure Spring whenever possible
Provide production-ready features such as metrics, health checks and
externalized configuration
Absolutely no code generation and no requirement for XML configuration
One of the ideas applied in Spring (not invented by Spring) is
Do not reinvent a wheel.
Having a single controller is not a good idea I'd say - breaking separation of concerns principle.
You can learn more about MVC from Spring documentation.

what is difference between spring framework and spring roo

Can anyone clarify what are the differences between Spring Framework, Spring ROO, and Spring MVC ? I am really puzzled by these similar terms and cannot mangage find an answer.
It's really easy:
Spring Roo is a DEVELOPMENT-TIME tool, similar to Eclipse, IntelliJ, etc.
Spring Framework is a RUN-TIME framework.
Applications generated with Spring Roo at development time use Spring Framework at run time.
Hope this helps.
I do not want to be rude, but also from SO tags we know:
spring
The Spring Framework is an open source framework for application development on the Java platform. At its core is rich support for component based architectures, and it currently has over a dozen highly integrated modules.
https://stackoverflow.com/tags/spring/info
spring-mvc
Based on the Model-View-Controller (MVC) pattern, Spring MVC helps you build web-based applications that are flexible and decoupled from the underlying view technologies.
https://stackoverflow.com/tags/spring-mvc/info
spring-roo
Spring Roo is a lightweight tool aimed at developer productivity. Via an intuitive command line interface it supports operations such as Java web project creation, persistence configuration and view scaffolding. Roo creates a Java web project that uses the Spring framework, and leverage some best ...
https://stackoverflow.com/tags/spring-roo/info
My own brief description would be: Spring framework is the framework providing some functionalities for example dependency injection. Spring MVC is for creating web projects as you mentioned already. Finally Spring Roo is a tool, that helps you increase productivity, I'd say that instead of manual configuration changes you are using this tool.
Hopefully, this was not too brief...

Spring Framework, Spring Security - possible to use Spring Security without Spring Framework?

Ive been working now with the Spring Framework 3.0.5 and Spring Security 3.0.5 for several time. I know that Spring Framework uses DI and AOP. I also know that Spring Security uses DI, for example when writing custom handlers or filters. Im not sure whether Spring Security also uses AOP - so my first question is: does it?
Well, Id also like to know how Spring Security can be used for non-spring-based applications. Its written in their documentation that this is possible. Well, I wonder how - it seems like it uses DI, so how should it work in a simple java web application? I guess at least a web container which supports dependency injection is needed, correct? (Which one could that be?)
Thank you for answering :-)
[EDIT]
documentation says:
"documentation says: "Spring Security provides comprehensive security services for J2EE-based enterprise software applications. There is a particular emphasis on supporting projects built using The Spring Framework, which is the leading J2EE solution for enterprise software development. If you're not using Spring for developing enterprise applications, we warmly encourage you to take a closer look at it. Some familiarity with Spring - and in particular dependency injection principles - will help you get up to speed with Spring Security more easily.""
j2ee-based enterprise software applications......... emphasis on supporting projects using spring framework...... well this means it should be possible to work with it without Spring Framework itself!
?
AND:
Even though we use Spring to configure Spring Seurity, your application doesn't have to be Spring-based. Many people use Spring Security with web frameworks such as Struts, for example.
This is from the spring security homepage. well....
Does it use AOP ?
Yes spring-security uses AOP for its method security (you'd have to search the page to find it).
Can you use spring-security without spring ?
Generally no.
As you need to define spring beans for several spring-security elements.
But! You can use Acegi security without spring as far as I know. Which should give you close to the same functionality.
Can you secure a non-J2EE application
Definitely.
Anything that can run in a servlet container can be secured with spring-security. You just need Spring's IoC/DI.
This answer can help you on the minimal spring-security dependencies.

Resources