Guice vs Spring Boot [closed] - spring

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Someone said to me Guice is a better choice for a restful micro-services.
I said ...
Spring Boot offers:
- Core Spring Support - DI + AOP
- Auto-Configuration: Web, Rest, Data, etc
- Activation Profiles: activate bits of code based on profiles
- Simplified Web Development: code driven, no xml, no web.xml etc
- Web Testing Support: successful testing is easy testing
- Security Support: out of the box that can be customized
- JMS: out of the box support and can be excluded if not needed
- Actuator: health, trace, beans, info + much more etc
- Executable and deployable WARs
- Natural fit for restful micro-services
- Fast loading
- extensible, native cloud support and much more
In a real web application these are the kind features that are needed during development and after deployment to production.
Guice-rs complain about older versions of Spring and that it’s slow to load and programmer error issues and so on and so forth.
From my readings Guice was created for super large applications that have many many developers working on them and in this case using something like Spring may take longer to load. Guice is a DI framework that gives you fine-grained control on how to load application code fast.
Now I haven’t used Guice and don’t know Guice yet, can someone form the Guice camp educate me on if/how can Guice provide the above features.
Many thanks!

Spring Context is the package that offers "Core Spring Support - DI + AOP" which you mentioned before. The other features in that list are provided by other spring packages. Spring boot wraps them all into a single bundle with auto-configuration.
TL;DR spring-context is similar to guice, guice by itself does not cover the other items on your list.

Related

What next now that JSF and Spring are breaking up [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm working on a JSF/PrimeFaces web application running on tomcat which uses Spring to inject different services based on the deployment context. I was looking at migrating it to JSF 2.3 when I realized JSF 2.3 requires a CDI container yet Spring doesn't implement the full CDI specification and from what I've read, are not going to do so any time soon.
So my question is two folds:
1) how are people out there dealing with this? I've read there might be some workaround to bridge the CDI with Spring? But which bridging solution would you recommend? Is bridging a long term solution and does the bridging have any drawback (none working features for instance)?
2) if JSF is no longer an option, what web front-end technology would you use for a new Spring-based application? back to JSP? templating like thymeleaf? GWT or vaadin? Javascript technologies like reactJS or angular and working with two languages and data model?
Thanks for sharing
My organization used to be on JSF + Spring, but now we are moving toward Spring MVC + Thymeleaf. Using Angular or React with Spring MVC REST is not a bad option either, but Spring MVC + Thymeleaf will be a much more natural fit with much faster onboarding for the Java team.
MyFaces 2.3.x should still work on Spring. However, i'm not sure if this will be possible with 3.x.
If you don't want to drop Spring, you can also add the CDI implementation "Apache OpenWebBeans", which is very very small (between 0,5mb and 1mb).
There are "bridges" available on the web, how to inject Spring beans into CDI beans and vice versa.

Why use Spring Boot rather than Spring Boot-less? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm confused why should i use Spring Boot for my next project? Is Spring Boot as powerful as Spring Boot-less? Or there is something you can't do with Spring Boot.
Spring Boot is opinionated Spring setup with batteries included. If you use it, you will waste less time on non-features because you will be getting quite a few things for free. List of advantages that I've observed compared to classical Spring setup (surely there are more, check the Spring Boot website):
dependency management - versions of commonly used libraries are pre-selected and grouped in different starter POMs that you can include in your project. By selecting one Spring Boot version you are implicitly selecting dozens of dependencies that you would have to otherwise select and harmonize yourself
auto-configuration - you do not have to manually configure dispatcher servlet, static resource mappings, property source loader, message converters etc.
advanced externalized configuration - there is a large list of bean properties that can be configured through application.properties file without touching java or xml config
"production ready" features - you get health checking, application and jvm metrics, jmx via http and a few more things for free
runnable jars - you can package your application as a runnable jar with embedded tomcat included so it presents a self-contained deployment unit
I haven't observed any disadvantages, it's just Spring after all. You can build anything that you could build with "vanilla" Spring, only faster.
Here is my simple explanation:
Without Spring Boot, one will have to put the correct versions of all the dependencies in the build configuration file (e.g. pom.xml) and configure all the beans manually.
This seems like a lot of non-functional task for normal projects. Hence, Spring Boot does these automatically, assuming some conventions. For example, if you just include spring-boot-starter-web dependency in your pom.xml, a web application will be automatically configured by assuming default conventions.
What makes it more interesting is that the pieces of the default configuration can be very easily overridden.
Going through a couple of official guides would give more insight on Spring Boot. In summary, unless an application is abnormal enough, people seem to be preferring Spring Boot nowadays.
Coming to power, Spring Boot could be seen as just a configuration layer. So, everything possible in Spring should also be possible using Spring Boot.

Advantage of Spring Boot [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have been trying to understand Spring Boot and maybe migrate my project to it. However I do not get the real advantage of it except the embedded Tomcat. Would you kindly explain to me what is the real power of Spring Boot compared to regular Spring?
Quoting from the Spring Boot Page, it has following 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
The big advantage is out of the box configuration based on what it finds and server embedded (you can make a jar run it and go to localhost:8080 to see the result) beside that it has metrics, health checks, externalised configuration, etc.
In my opinion is the perfect tool for building cloud microservices.
Bootstrapping with defaults included in the configuration / jar-dependencies, is the real advantage of Spring boot! Get the things done quickly!
Its just another project from Spring framework, where things look simplified, with strong support for Security, Data, Social etc all features you want for your application.
If you prefer annotations over XML configuration like me you might use
#Configuration for configuration,
#ComponentScan for Dependency Injection,
and #EnableAutoConfiguration to tell spring to guess the defaults
and work along.
The #SpringBootApplication annotation is equivalent to using
#Configuration,
#EnableAutoConfiguration,
and #ComponentScan
with their default attributes.
So things further simplified, with a single annotation doing the work of 3.
It's real easy to get something going from nothing, with loads of useful defaults.
Not so easy if you want to migrate some existing project which will most likely have developed a lot of quirks that are going to be difficult to migrate.
Advantages of SpringBoot:
No need of creating boilerplate configuration
Plenty of SpringBoot Starter to quickly get up and running
DevTools to autorestart server on code/config updates
Embedded Tomcat/Jetty/Undertow support
Easier customization of application properties
Easy management of profile specific properties
Easier dependency management using platform-bom
Here are few of my articles on what are the advantages of SpringBoot and how SpringBoot works.
Why SpringBoot?
How SpringBoot AutoConfiguration magic works?
Biggest of all is that spring boot is aligned with the concept of microservices and can be run from a container anywhere e.g. cloud. This possible because the following nature of springboot
small footprint
standalone services
easier to launch from a container, each service can be in its own container (like docker)
easy to configure and deploy completely from a script. Good for auto-scaling and deploying in the cloud.
In active development,spring boot has the advantage of leave the complex xml file configure.
1.Embedded tomcat discard the web.xml configuration;
2.spring-boot security discard the applicationcontext-security.xml configuration;
3.spring-boot webservice discard the applicationcontext-ws.xml configuration;
4.spring-boot mvc discard the applicationcontext.xml configuration;
5.spring-boot datasource(both Relational Database and nosql Database) discard the applicationcontext.xml configuration,even if more than one datasource.
Discard this configuration file easy our development and improve the efficiency.

Why using Spring DM? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
1/ did Spring DM is very used now on Enterprise Applications ? what are the benefits of this framework and why it seem like a dead technology
2/ I'm working on a Spring Application , I want to do it as an SOA and i don't know if spring DM will be useful for me.
3/ I have another question , we can integrate an open source solution ESB with Spring ? what's the best choice for ESB.
Thanks !
1) Spring DM is mostly abandoned by Spring, as well as OSGI support. See this key quote from the Spring creator in this important interview on the subject:
We have changed our views on OSGi over the years, and one of the
reasons for that is that OSGi simply cannot be made as easy to use and
as productive as we feel is consistent with Spring values.
See also SpringFramework Removes OSGi Metadata in Move to Gradle
2) and 3) try to use Spring Integration or Apache Camel, which is well integrated with Spring. Both allow to have ESB like functionality embedded in a normal WAR application, so no need for a separate ESB server.

Difference between Java EE and Spring framework [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am striving to know the difference between Java EE and Spring Framework. Could anyone please help me on this.
Java EE is an standard, official, specification for a full featured Enterprise Application Framework stack. Includes stuff like Object-Relational Mapping, Security, Web Applications, database connectivity, transactions...
On top of Java EE specifications there are JavaEE implementations/application servers like: JBoss, Glassfish, WebSphere, Weblogic.
Spring on the other hand, is a framework doing lots of the stuff on the Java EE specifications, but in its own form. They don't follow Java EE specifications and APIs for that. But they do include a Web Framework, transaction management, security and several other solutions Java EE offers.
Java EE:
Java EE industry approved standard API based framework
It is predominantly based on annotations and CDI
JFC MVC framework for web development
JPA specification to process DB operation
JTA API with implementation
EJB container and POJO based implementation
Oracle license
Spring:
Based on IOC and AOP
Based on XML configuration (now they are leveraging annotation)
Uses Spring DAO framework (based on Template design pattern) to connect to database
Provides abstraction layer to support various JTA implementation vendor
Integrates with various Java vendors to support different capabilities such as struts etc
Provides an end-to-end platform to build web application achieving loose coupling using DI and AOP
Open source license
Java EE:
A Sun/Oracle standard that app server vendors conform to
Based on Enterprise Java Beans
Implemented by many vendors: BEA/Oracle, WebSphere, JBOSS, Glassfish, etc.
Spring:
Not a standard; it's the brainchild of Rod Johnson and implemented by Spring/VMWare.
Not based on Enterprise Java Beans; it's a POJO model. Can manage EJBs if you wish to use them, but not required.
Not implemented by any vendor other than Spring.
EJB 3.1 has taken a great deal from Spring. Now it includes dependency injection, a form of aspects, and JPA. EJB 3.1 is much closer to Spring than EJB 2.0 was.
I provided an overview of Java EE here Frameworks for Layering reusable Architectures
This also contains a small comparison with Spring, which might be relevant for this question.

Resources