Use embedded tomcat instead of netty with spring-gateway - java

I'm running this project: https://github.com/wdahlenburg/spring-gateway-demo
It uses netty by default, how can I change it to embedded tomcat instead? I've tried to modify the pom.xml and replaces spring-boot-starter-test with spring-boot-starter-tomcat, but it doesn't work.
Does anyone know how to do that?

I don't think it's possible, spring cloud gateway is build on top of reactive Spring WebFlux project and requires netty runtime, as stated in docs:
Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.

Related

AWS #SqsListener not working with spring cloud (using springboot 3)

Currently, we have an SQS client configured using an IAM Role that is picked up on the cluster. However, migrating over to Springboot 3 the #SqsListener is no longer consuming the messages.
NOTE: Same code, works on Springboot 2, but not on Springboot 3 is there something else that needs to be configured or am I missing something?
Anyone else run into this issue?
Spring Cloud AWS 2.x is only compatible with Spring Boot 2.x, for Spring Boot 3.x, Spring Cloud AWS 3.0 is necessary.
See compatibility here.
The 3.0 RC version has just been released, feel free to try it out and provide feedback!
Spring Boot 3.0x requires Spring Cloud AWS 3.0x and AWS Java SDK 2.x
Visit this link for info
In order to create a Consumer in Spring Boot 3.0, you need to use #EnableScheduling Bean in your main application. Then you need to use #Scheduled(fixedDelay = 5000) above the receive method. #Scheduled bean replaces the #SqsListener here. You can visit this link for more info.
In order for the #SqsListener annotation to work, the dependency spring-cloud-aws-autoconfigure is required - this autowires the containers etc. needed for the annotation to function. You can see the extra stuff it autowires here.

Why tomcat is not required in spring boot

I am new in spring boot. can anyone help me out with this? Why tomcat is not required in spring boot? Any help well be great.
A Spring Boot Application contains the binaries for the server (example, tomcat.jar). It means you can run a web application as a normal Java application.
As you can see in the following text from https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-embedded-web-servers, you can change the server to a server of your choice:
For servlet stack applications, the spring-boot-starter-web includes
Tomcat by including spring-boot-starter-tomcat, but you can use
spring-boot-starter-jetty or spring-boot-starter-undertow instead.

Embed Grizzly (glassfish) Servlet Container with Spring Boot Java

Spring boot by default uses Tomcat as an Internal Embedded Servlet Container .
It has also got support for Jetty and UnderTow.
I have build a Restful Application using spring boot . But now i need to deploy it on Grizzly (Glassfish) Servlet Container .
How do i embed my application to run on grizzly as spring dosen't have support for the same.
https://github.com/spring-projects/spring-boot/issues/5015.
Please help as i researched a lot on thistopic but i coudnt get any link that shows how to embed a new Servlet Container for our spring boot app that spring dosent have support for.
Thanks
The Grizzly website states that Grizzly's servlet support is incomplete:
This is not a Servlet compliant implementation and as such, not all features exposed by a typical Servlet container are available here.
I haven't seen anywhere that expands on what those missing features are, but there's a good chance that what you're trying to do isn't possible without filling in some gaps in Grizzly's servlet support.
Assuming that it is possible, you need to write Grizzly-specific implementations of Spring Boot's EmbeddedServletContainerFactory and EmbeddedServletContainer interfaces. This is a fairly significant amount of work so, before undertaking it, I would ask yourself what you will gain by being able to use Grizzly as an embedded servlet container versus using Jetty, Tomcat, or Undertow which are already supported out of the box.
If you do decide to tackle this, reading the source code for the existing implementations for Jetty, Tomcat, and Undertow is the best way to learn about what needs to be done:
JettyEmbeddedServletContainer.java
JettyEmbeddedServletContainerFactory.java
TomcatEmbeddedServletContainer.java
TomcatEmbeddedServletContainerFactory.java
UndertowEmbeddedServletContainer.java
UndertowEmbeddedServletContainerFactory.java
As pointed by #Andy there is no support for Spring Boot and Grizzly .
Finally i moved to Spring MVC for the same.
Here is the working repo where i embedd Spring MVC with grizzly.
Hope it helps someone.
Link
There is now a third-party implementation of a Spring Boot starter for Grizzly which has specific implementations of the Spring Boot's EmbeddedServletContainerFactory and EmbeddedServletContainer classes for Grizzly.
Besides that it also offers JSP support through Tomcat's Jasper JSP engine, simply by specifying an additional dependency. You can find the project at GitHub and it is also listed in the Spring Boot starters list.

How to implement RMI with Spring 4?

Update
Sorry for not being clear in my question, I am developing a Spring project with the next dependencies
Spring Boot
Spring Data
Mysql
wsdl
In the project I exposed soap Web services with Spring Data for persistence, I have to use RMI for support of application desktop.
I tried the following :
Integrate in the same project Spring and RMI (using RMI Register ) successfully but when I tried use Spring annotations obviously not working.
I'm searching when I found that Spring have support for RMI using XML configuration but I need the configuration in annotations.
My question How to would implement RMI in my project?
I'm using latest version in all dependencies

What do I need to download to start developing apps using the Spring framework?

I need to start developing applications using the Spring framework, and am wondering what tools I need to download to have me up and running.
On the SpringSource website I am seeing all these applications to download and I am wondering, do I really need all this? And what versions should I use, especially for Spring Framework?
Spring Framework
SpringSource dm Server Samples
Spring Security
Spring Web Flow
Spring Web Services
Spring Dynamic Modules
Spring Integration
Spring Batch
Spring.NET
Spring JavaConfig
Spring LDAP
Spring Extensions
Spring IDE
Spring BlazeDS Integration
SpringSource Bundlor
Spring ROO
What other applications do I need to download (eg. Struts, Glassfish, Apache, etc.)?
This depends on what you want to use Spring for. Typically that's Web applications. If so you only need two things:
Spring framework (with minimal dependencies); and
A servlet container (eg Tomcat) or a full-blown application server (eg Glassfish, JBoss).
Everything else is optional. I believe the only required dependency is Apache Commons logging. Depending on what features you use, you may well need more.
If so, here is a [tutorial][1] that creates a barebones Spring MVC project. There are countless others around for that and other topics.
It's entirely possible to use Spring in, say, a Swing application in which case you obviously don't need a servlet container.
All you need from SpringSource is the Spring Framework.
Spring 3.0 is on the way, but for now, use 2.5.6.SEC01, the current production release.
You can get started with a simple servlet container (ie: Tomcat) rather than a full blown application server (eg: JBoss, Glassfish).
The Spring Framework comes bundled with jars for web development - ie: spring-web and spring-webmvc.
See #117535 for a simple example of using Spring MVC.
It mainly dependent on what you need Spring for. Each and every piece of Spring can, actually, be used in separation from the rest. You may use it only for IOC, in this case you don't need, for example, MVC and Servlets, etc...
The easiest way to start is to dowload the main package from http://www.springsource.com/download/community?project=Spring%20Framework
You can use Spring from any IDE
The best way is to use Maven with your project. Basically all you have to do is edit your pom.xml file and tell it that you want to use Spring. Then when you compile your code, Maven will go out and automatically download the Spring libraries you need from their public repository.
Here's an example:
http://pookey.co.uk/blog/archives/63-Getting-started-with-Maven-and-Spring.html

Categories