What resources are available for Spring Integration best practices - spring

I'm working on a project where we're working with both Spring Integration & AMQP for the first time.
I'm noticing there appears to be a lot of XML configuration involved in wiring everything together. Our config files are already very messy, and it's getting tricky to keep across how everything is hanging together. I'm worried we're about to make some preventable mistakes.
What resources are available that provide guidance on how to structure large-scale, real-world spring integration & AMQP projects.
eg:
What naming conventions should we follow for channels / queues / exchanges
When to employ XML config vs Annotation based config
Is it ok to mix & match annotations & xml, or is this a recipe for disaster?
How to layout the bean definitions for ease of use
Note - I'm not looking for guidance on what the various components do, more - how to structure your project to foster maintainability.
Ideally, I'm looking for:
Blog posts
Books
StackOverflow answers (answers inline would be great, too)

It is not SI and AMQP specific but, I think reading
Enterprise Integration Patterns : Designing, Building, and Deploying Messaging Solutions by would be very helpful. Also this link has also good resources.

Also you can view this Spring Integration Practical Tips and Tricks video.

Related

Which graphql-spring-boot-starter should I choose?

I'm thinking about adding GraphQL functionalities to my Spring Boot application.
I found there are two artifacts for that.
One is com.graphql-java-kickstart:graphql-spring-boot-starter and the other is com.graphql-java:graphql-spring-boot-starter.
Which one should I choose?
These are different Starters (by different teams) providing different features, so there's no right or wrong answer. Here's a quick overview of what I'm aware is available:
The original starter made by the graphql-java team (com.graphql-java:graphql-spring-boot-starter) is now, I believe, defunct and superseded by the Spring GraphQL.
Spring GraphQL (org.springframework.boot:spring-boot-starter-web or org.springframework.boot:spring-boot-starter-webflux) is intended for schema-first development, is relatively simple and not very feature rich, but it's easy to use and works well with other Spring projects (like e.g. WebFlux and Spring Security).
If you want to go code-first (which I argue is still schema-first, just better), use graphql-spqr-spring-boot-starter, which will generate the GraphQL schema and an end-point for you, with no extra code needed. It's quickest way possible to expose Spring services. There's a sample project here. I'm the main author of that project, so this is a shameless plug, but I honestly believe it's lightyears ahead of other projects in terms of usability. The next version will be based on Spring GraphQL, so it should inherit most/all benefits as well (like e.g. RSocket support, which it currently lacks).
There's also DGS by Netflix (com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter). It is also schema-first, has a plenty of features, but is also highly opinionated. I have no first-hand experience with it, but it is well documented, so you should have no problems finding what you need about it.
If you're already using graphql-java-tools (maintained by the Kickstart team), you'll likely want to go for com.graphql-java-kickstart:graphql-spring-boot-starter as they're intended to be used together. I have no clue how actively this project is maintained these days.

Spring Gemfire Cache implementation

I am trying to implement cache mechanism provide by Spring Data GemFire. Has anyone implemented a solution? I need to check on performance and ease to implement it.
Sonal-
First, you can find plenty of examples in the Spring User Guides, here, for example...
Accessing Data with GemFire,
Caching Data with GemFire, and ...
Accessing GemFire Data with REST
Additionally, there is a Spring GemFire Examples project here.
I have also started work on building a "Reference Implementation" (RI) for Spring Data GemFire/Geode, here. I have much work to do with this project yet, like documentation (READMEs) in the Repo, but I do plan to keep it up-to-date with my latest developments since I use the code as a basis for all my conference talks. Anyway, there is plenty of code examples and tests in this GitHub project to keep you busy for awhile.
Then, the Spring Data GemFire and Spring Data Geode GitHub projects themselves, have plenty of tests to show you how to address different application concerns (Configuration, Data Access, Function Execution, etc, etc).
Of particular interests might be the new Annotation-based configuration model for SDG^2 that I am working on. This is currently a WIP and I am also working on User Guide documentation for this feature/functionality, but it is established and even inspired by the auto-configuration features and Annotations provided by Spring and Spring Boot (e.g. #EnableXYZ).
Users have even started using the Annotation-based configuration model without significant documentation in place since it builds on concepts already available and familiar in Spring Boot. In fact combining these SDG specific Annotations with Spring Boot makes for a very powerful combination while preserving simple/easy nature to get started, 1 of my primary goals.
Given the lack of documentation yet, you can find more out in the Spring IO blog, where I first blogged about it here. Then I expanded on this article in a second blog, talking specifically about security.
And if you are really curious, you can follow the latest developments of the Annotation configuration model in my testing efforts.
Finally, of course, as I have already alluded to, as any good developer knows, getting started is as easy following the examples and reviewing Spring Data GemFire Reference Guide and Javadoc.
Don't forget to familiarize yourself with Pivotal GemFire as well! Javadoc here.
Hope this helps!
-John

Customizing Spring Initializr

I am working on bringing up a new team in the Spring Boot ecosystem. I love the Spring Initializr service. We have written custom Gradle plugins for unifying our build systems across many Spring Boot projects. I am looking to provide our team with an Initializr that will take advantage of our build tooling as well as inject some of our business practices into the scaffolding of the project.
With these goals in mind we have decided that extending the wonderful Spring Initializr and running a custom instance locally makes a lot of sense.
Unfortunately, it appears that the Initializr project has very little documentation about customizing it, beyond the basics of editing the YAML configuration and the Templates for the java files, it is difficult (for someone with no Groovy Templating experience) to figure out how to best extend the Initializr such that we maintain much of the functionality but can also extend the site and service appropriately.
We have built the github project from source, and published the artifacts to our local artifactory, and have successfully created our own project that uses those artifacts as a dependency and stands up a mildly customized service (basic HTML and Java source editing, simple YAML configuration).
Can anyone help with even basic resources for extending the functionality of the Initializr? perhaps a roadmap? a project specific forum? really any help is appreciated, my google-foo seems to be failing me.
I know this is a reasonably broad question, but I am failing to get in touch with the right people, or find the resources for this.
So the answer is indeed Gitter. Spring Initializr should be seen at the moment as a service and not a library. We do our best to make sure things are nicely separated but that's not the case yet for everything (read: designed for extension).
We have some plans to allow external components to customize how the project is generated. It would help if you could share your use cases on the gitter channel. Thanks!

Learn about the architecture or relationship between CXF, Spring, JAXWS, etc

I was thrown into a CXF-based project in which the basic HowTo tutorials are easy to follow and implement but the moment there is a problem or a bug in the system, all kinds of exceptions are thrown without me understanding any of the relationship between the various components.
I know that CXF builds on top of Spring.
But I have no experience with Spring and I don't know how it works.
I have also seen references to JAXWS in the cxf.xml but I don't know how it is related to either Spring or CXF.
I can build a perfectly working (simple) CXF-based web service. Contract first, using wsdl2java in a pom.xml (copycatting a sample).
But the moment I face a problem, I am stumped, relying on some tips and clues gleaned from the web.
Ideally, I would like to have a tutorial that walks me through the history of how web services evolved from Java only, to J2EE, to JAXWS, to Spring, to CXF.
But I couldn't find any.
I did find the official Apache CXF documentation but it assumes a lot of prior knowledge that is more than just knowing the Java language.
Any recommendations on how to get to a point of truly understanding what I am doing when I build a web service?
A recommended book? Online tutorial?
Thanks.
Yip it is a bit of a learning curve but well worth it. As far as books are concerned you can try the following.
Apache CXF Web Service Development
Spring In Action
Please be aware that J2EE and Spring are not evolutionary linked to each other Spring was more a reaction to the heavy weight J2EE specification of old. CXF is a web services toolkit/API that can be used outside of J2EE as well.
I would suggest you also join the user lists of the CXF projects and ask questions there. Also why not post some of the code causing exceptions here so we can help you with more detail?

Spring MVC Framework easy?

I m a newbie & i m good at Struts framework. Today i tried a tutorial for Spring MVC Framework.
The example url that i tried following is as below:
http://static.springsource.org/docs/Spring-MVC-step-by-step/part6.html
I think they have made this tutorial much more complex especially near its end. I saw some errors mainly typos in part 5, part 6 of tutorial. I found Spring framework as not properly organized and how would we know what classes to extend especially when their names are so weird (pardon my language) e.g. AbstractTransactionalDataSourceSpringContextTests.
Overall i found that Spring is making things much more complex than it should be. I'm surprised why there is such a hype about Springs being very easy to learn.
any suggestion how to learn spring easily ? how to judge what to extend ? is there a quick reference or something?
The tutorial you have referred to covers all the layers of the application - data access, business logic and web. For someone who is looking to only get a feel of Spring MVC, which addresses concerns specific to the web layer of the application, this could be more information than required. Probably that is why you got the feeling that the tutorial is complex.
To answer your questions, Spring is easy to learn because the whole framework is designed to work with POJOs, instead of relying on special interfaces, abstract classes or such. Developers can write software as normal Java applications - interfaces, classes and enums and use Spring to wire the components up, without having to go out of the way to achieve the wiring. The tutorial you have referred to tries to explain things in a little bit more detail than experienced programmers would typically do in a real application, probably because the authors wanted the readers to get enough insight into how Spring works so that concepts are understood well.
In most applications (regardless of their size or nature), there is typically no need to extend Spring classes or to implement specialised classes. The Spring community is quite large and an even larger ecosystem of readily available components exists that integrate with Spring. It is therefore very rare that one has to implement a Spring component to achieve something. For example, let us take the example of the data access layer. Different teams like using different approaches to accessing databases. Some like raw JDBC, others like third-party ORMs like iBatis or Hibernate while some others like JPA. Spring distributions contain classes to support all these approaches. Similarly, lets say someone was looking to incorporate declarative transaction management in their application. Again, transaction management can be done in many different ways and a large number of transaction management products are available for people to use. Spring integration is available for most of these products, allowing teams to simply choose which product they want to use and configure it in their Spring application.
Recent Spring releases have mostly done away with extensive XML based configuration files, which being external to the Java code did make Spring application a bit cumbersome to understand. Many things can be done nowadays with annotations. For example,
#Controller
public class AuthenticationController
{
...
}
Indicates that AuthenticationController is a web MVC controller class. There are even ways to avoid using the Controller annotation and follow a convention-over-configuration approach to simplify coding even further.
A good and simple tutorial to Spring MVC is available at http://www.vaannila.com/spring/spring-mvc-tutorial-1.html. This tutorial uses XML based configuration for Spring beans instead of annotations but the concepts remain the same.
I have seen tutorial you follow , Its seems you have follow wrong one first , you first tried to simple one, Instead of tutorials you should go for book first
I recommend you two books to understand the power of Spring
spring in action and spring recipes.
For practical you can use STS a special ide for spring project development.Its have some predefined template you dont't need to write whole configuration yourself.
In starting just see simple tutorials like Spring mvc hello world , form controller than go for big ones
Spring is very cool , All the best.

Resources