Confusion regarding Async Servlet support in Spring 3.2.0.M1 and Jetty - spring-mvc

Spring 3.2.0.M1 was released today with support for asynchronous #Controller methods. I'm trying to use this in an existing web app deployed as a war on Jetty. However, I've a few fundamental questions.
Do I need Jetty 8 OR this should run on Jetty 7 as well.
Is the async support build on top of Servlet 3.0 API or it is something that Spring MVC has implemented. In other words, do I need a Servlet 3.0 supported container for asynchronous controller to work.

On the topic of Jetty, servlet 3.0 support is in Jetty 8. You can not use jetty-7 as it implements only servlet 2.5 support. You can get async behavior in jetty-7 through jetty-continuations but that is not the same api as in servlet 3.0.
So that is 1/2 an answer only, I can't speak to the spring side of things.

Related

Spring Swagger UI: what is difference between io.swagger, io.springfox, and com.mangofactory

I am working on integrating the swagger UI with a spring boot MVC app and I am curious as to the differences between these libraries.
I looked at each on mvnrepository.com and they are all done by different groups but seem to do the same thing. I am hoping to get a clear idea of the differences between these and if one is recommended over the others. I notice the swagger-core module by io.swagger has the most usages.
Thanks!
Here is an explanation of the different libraries.
Springfox is in a sense v2 of the swagger library that used to be packaged as mangofactory. What happened was we transitioned from using a private repo to creating a github organization so support development as a team.
In short mangofactory evolved into springfox which supports 2.0 version of swagger spec (in addition to 1.2). To be clear springfox and its predecessor supports spring mvc.
io.swagger is the mother ship if you will. It has great support for spring and jax-rs. So if you're looking for support for Jax-rs based services using spring or otherwise that's a great option.
io.swagger is the package for swagger libraries and you need separate spring jars to couple it with Spring. This is version 2 of swagger.
io.springfox is Springfox Swagger2, wherein swagger comes integrated with Spring.
com.mangofactory is swagger integrated with Spring Web MVC framework.
To understand differences between Spring Web MVC framework and spring, you can read this:
what is the difference between Spring and Spring MVC framework

integrate vert.x and Spring MVC

I have a running app in vert.x. I have many missing features or I just can say missing spring.
How can I integrate vert.x and Spring MVC working on a Tomcat server?
With Vert.x 3 I would think you would want to use the Vert.x Web capabilities as described here instead of Spring MVC if you want to give Vertx a go. It provides a different approach to developing a web application using the Multi-Reactor pattern than the traditional multi-threaded Servlet model which Spring MVC is based on. With the Servlet model every request runs on its own thread. In Vert.x there is an event loop that is single threaded. All requests are run on the same thread, which requires blocking I/O code to be written in special blocks (see Core Manual).
Depends on which Vert.x version you are using. 2.x requires a module. like mod-spring-appcontext. In Vert.x 3.x just create a Spring ApplicationContext in your code, typically in the entry point of your application, like your public static void main method. I can't get into more detail. Vert.x questions rarely, if ever, get noticed here.
I would not recommend working with vert.x on a tomcat container as there philosophies are completely different. Tomcat is a servlet container which creates different thread for each incoming call whereas vert.x works on a event-loop. If you are missing spring and will like to use its bean you can integrate it in vert.x environment and run any blocking code in worker verticles.
You can see an example here : https://github.com/vert-x3/vertx-examples/tree/master/spring-examples/spring-example

How to inject facade in servlet on jboss 4.2.3GA?

I've got EJB 3.1 app running succesfully on JBoss 7.1
My task is to get it running also on JBoss 4.2 with EJB3 plugin.
App runs OK there except one thing:
In web servlet, I'm using
#EJB
private ExchangeRateTableEntityBeanFacade exchangeRateTableEntityBeanFacade;
to inject my facade and call method findAll(); to select all rows in related table.
As I've learnt, this is not possible on JBoss 4.2 and I am getting NPE at the moment.
Any ideas how to inject, look up this one?

Does Mule supports Spring MVC?

I have web app which is already developed based on Spring MVC. I need to re-implement that web app in Mule.
Can I develop the mule application based on Spring MVC?
Can I declare the Spring MVC dispatcher servlet inside a mule's servlet endpoint and take things further from there?
The web app has web.xml where it defines the DispatcherServlet, the contextparams, the listener classes and so on. How can we remodel that in a mule application?
Any examples where a mule application is developed based on SpringMVC would be great.
Thanks to its embedded Jetty container, you can deploy any JavaEE web application in Mule. So there's no need to remodel anything.
The "Boosktore" example application demonstrates running web-apps within Mule: https://github.com/mulesoft/mule/tree/mule-3.x/examples/bookstore
Mule ESB is not an MVC Framework. It is developed using enterprise integration patterns in mind.
Please go through this blog, to know when to use ESB.
spring mvc can be integrated with mule.
Define all your spring related configuration in separate xml file and include it in mule configuration file.
You can write your custom transformers ,in the custom transformations you can inject or do an autowire of your service classes and from service object you can interact with dao layers.

Spring 2.5 Controller Annotations

Spring MVC Question. I need to port a Spring 2.5 app to a Spring 2.0 Jboss server. The only Spring 2.5 constructs used are the following Controller Annomations: #Controller, #RequestMapping, #ReqestParm, #ModelAttribute and #Autowired.
I am having difficulty determining which base controllers to extend or implement.
Any thoughts on how to migrate Controllers back to 2.0 from 2.5 would be helpful. Ideally, a before (Spring 2.0) / After (Spring 2.5) example would be great.
I am new to Spring.
Thanks.
For controllers you may want to go back to the Spring 2.0 documentation:
http://static.springsource.org/spring/docs/2.0.x/reference/mvc.html#mvc-controller
I would just remove the annotations, that are causing a problem, and then replace them, so #Autowire becomes code in the application.xml file, the controller annotations you just follow the link above.
There isn't a migration so much as just removing the new features and just restoring the old way of doing these tasks.

Resources