rest client module integration test without spring boot app - integration-testing

I consider myself still fairly new to Spring and Spring boot. I have inherited a multi-module project that is structured like this:
project
|
+- api module
|
+- app module
|
+- rest client module
The app module contains the controllers. The jar created from rest client module is a dependency that is meant to be used by other projects. The rest client module makes rest calls to the app module, so that those other projects don't have to make the rest calls themselves.
I have been able write integration tests for the controllers in the app module, but I've been struggling with trying to write integration tests for the classes in the rest client module. My understanding is that the rest client module does not load up a Spring context since there is no #SpringBootApplication-annotated class like the app module has.
I think my questions then are:
should I be trying to write integration tests for classes in the rest client module?
if so, how do I do this?
Thanks in advance.

Related

Can we use SignalR in .NET Rest API project?

I have minimal API projects in .NET core 7. The frontend project is separate and created in Vue JS. I need to use SignalR for the notification module, but I can't figure out if this is really possible?
in.NET, all I have is REST APIs for my project, I created an API for SingleR, and it's being called from Vue JS, but the message is not being delivered to the client. Connect ID is being generated. Do I need to create some background services etc. in my understanding, once REST API is being called, it can't be connected forever for WebSocket purpose.

Spring Boot jar into existing Spring Project

We have an existing Spring MVC based application. I was asked to plug-in a customization/utility to this project. I am not supposed to do any changes to the existing application.
For the new utility, I thought of doing it through a Spring boot jar. I created a Spring boot jar and placed in the lib folder of the existing application. However, I am facing few issues with this approach and wanted to know if this is the correct approach and if there are any suggestions out there. The issues are:
The logging level of the Spring boot affects the logging level of the existing application. How can I avoid that?
The Spring MVC application and the Spring boot jar both are based on different versions of Spring. What if there are some common class files or packages in both Spring MVC application and the Spring boot jar but with different versions? Will this create any conflicts or will it affect the functionality? I don't want my Spring boot jar to affect the functionality/logging of the existing application. I just want the Spring boot jar to work whenever it is being called explicitly.
For logging issue, I have tried to use something like below in application.properties file but the issue with that is that those settings are considered only if you run the application through #SpringBootApplication main class. But if you just want to package your functionality in a jar file then the application.properties file is not considered.
logging.level.org.springframework = OFF

Struts migration to Spring MVC - via Spring Boot

We are in the initial stages of converting a Struts 1.2.9 application to Spring MVC. While the impact has been analyzed and well documented and understood for this migration, we are uncertain if we should introduce Spring Boot in this equation.
I have been reading other threads and would like to state that we are not looking to integrate Struts with Spring - rather we are for sure migrating and moving out of Struts to Spring MVC.
Given this background, invite suggestions/thoughts around below:
Benefit of introducing Spring Boot in this process is more of a distant one of an eventual move to Cloud. As such the team has completed the initial configuration required for a Spring application (like web.xml, required jars, spring-servlet.xml) and not sure of immediate benefits for us.
In case we decide to use Spring Boot in this process, we perceive the impact to be:
i. Add spring-boot-starter-web to our gradle build.
ii. Create a starter Application class
iii. Revisit configurations in web.xml like startup servlets using 'SpringBootServletInitializer'
iv. Continue to use a war based traditional deployment using gradle war plugin. Does this package the spring based libraries into the war or should the libraries be on the server classpath?
I welcome thoughts/suggestions/rejections of this as an approach itself :).

Using Spring Cloud Foundry project with a plain java web project

We have a plain java web project with some servlets, some JPAs and our logic.
We want to move to Cloud Foundry . I have learnt that Spring boot comes up with a lot of nice cloud foundry features out of the box like support for CF environment variables parsing, CF service broker API implementation.
Now i don't want to move to Spring MVC since we already have the application running with plain java web framework.
Can i still use Spring cloud foundry related projects to take advantage of Cloud Foundry related features like parsing of env variables ?
Are they internally dependent on Spring core, spring mvc projects ? Will including the Spring Cloud Foundry project bloat my total deployable war size due to all internal spring dependencies.
Best Regards,
Saurav
A lot of this depends on exactly which features you want to use. The awesomeness you get from Spring Boot requires Spring & so it won't transfer to your app unless you embrace & use Spring. The same goes for Spring Cloud.
You specifically mentioned parsing service information from environment variables (i.e. VCAP_SERVICES & VCAP_APPLICATION). This is the one exception that comes to mind. You can use Spring Cloud Connectors in a limited capacity without Spring. See this link for details. It's not as full-featured as what you'd get if you were using Spring & Spring Boot, but it will give you some help.
If you don't want to use SCC, you can always parse the environment variables yourself and use the data. It's conceptually very easy. Both VCAP_APPLICATION & VCAP_SERVICES are environment variables and the value is a JSON blob so all you need to do is parse the JSON and locate the information that you need.
Hope that helps!

STS & Spring Integration multiple xml files and merged Integration Graph

I am working on a project using spring integration. I am using XML because I like the visualization of integration flow using Integration-Graph in STS. But because of reusing components and reorganisation flows in subflows in separate xml files, I would like to have a merged view in the graph.
As I remember the Spring Bean Graph it was possible to select configuration files as package for visualisations.
Is there a functionality for Integration, too?
While that feature is not available in STS, we are working on a runtime visualization of a running Spring Integration application. Since 4.3, Spring Integration (when running in a web container or as a Spring Boot application with web support), can expose the runtime environment as JSON see documentation here.
The spring-flo project has a sample (it's still a work-in-process) for visualizing the flow.
The application used in the readme is the the file-split-ftp sample application. Notice the required CORS bean definition (which will be made simpler in the next release).

Resources