Using SpringMVC in Karaf 4.2.6

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Using SpringMVC in Karaf 4.2.6

duan2ping
Hi All,

I am trying to upgrade from karaf3.0.9 to karaf4.2.6. However, karaf4.2.6 does not support spring-dm. I want to continue using SpringMVC in karaf. What should I do ? Thanks!

Best Regards!
Duan
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi,

Karaf 4.2.6 still supports spring-dm if you add the spring-legacy
features repo:

feature:repo-add spring-legacy

The reason is that spring-dm only works if old Spring version (and it's
deprecated now).
So, you can still use it with spring-legacy, but I recommend to move to
something else (scr, blueprint, ...).

Regards
JB

On 31/10/2019 04:35, duan2ping DL• wrote:
> Hi All,
>
> I am trying to upgrade from karaf3.0.9 to karaf4.2.6. However,
> karaf4.2.6 does not support spring-dm. I want to continue using
> SpringMVC in karaf. What should I do ? Thanks!
>
> Best Regards!
> Duan

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Thanks JB,I will study blueprint, scr, to replace spring.
Regards
Duan

Jean-Baptiste Onofré <[hidden email]> 于2019年10月31日周四 下午1:06写道:
Hi,

Karaf 4.2.6 still supports spring-dm if you add the spring-legacy
features repo:

feature:repo-add spring-legacy

The reason is that spring-dm only works if old Spring version (and it's
deprecated now).
So, you can still use it with spring-legacy, but I recommend to move to
something else (scr, blueprint, ...).

Regards
JB

On 31/10/2019 04:35, duan2ping DL• wrote:
> Hi All,
>
> I am trying to upgrade from karaf3.0.9 to karaf4.2.6. However,
> karaf4.2.6 does not support spring-dm. I want to continue using
> SpringMVC in karaf. What should I do ? Thanks!
>
> Best Regards!
> Duan

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
In reply to this post by jbonofre
Hi JB

I tried to check out some information about using Blueprint, but there
is nothing to gain.

If use blueprint and scr instead of spring, does web application development
have a similar alternative to springmvc?
Or can you only use the original servlet method like the one below?

@OsgiServiceProvider(classes={Servlet.class})
@Properties({@Property(name="alias", value="/tasklist")})
@Singleton
public class TaskListServlet extends HttpServlet {
//......
}

I am very confused now.
How do I use Blueprint instead of Spring and SpringMVC to develop a Web
Bundle correctly, is there a related reference solution?

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi,

I compared spring and blueprint. I don't know enough SpringMVC to compare.

Anyway, SpringMVC is one think Spring DM is nother one.
You also have the Spring extender in blueprint, so, it should be possible.

About the servlet, yes, you can deploy a servlet in different ways. You
have examples here:

https://github.com/apache/karaf/tree/master/examples/karaf-servlet-example

Don't hesitate to ping me directly to figure it out.

Regards
JB

On 08/11/2019 09:50, duan2ping wrote:

> Hi JB
>
> I tried to check out some information about using Blueprint, but there
> is nothing to gain.
>
> If use blueprint and scr instead of spring, does web application development
> have a similar alternative to springmvc?
> Or can you only use the original servlet method like the one below?
>
> @OsgiServiceProvider(classes={Servlet.class})
> @Properties({@Property(name="alias", value="/tasklist")})
> @Singleton
> public class TaskListServlet extends HttpServlet {
> //......
> }
>
> I am very confused now.
> How do I use Blueprint instead of Spring and SpringMVC to develop a Web
> Bundle correctly, is there a related reference solution?
>
> Regards
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Hi JB


Because karaf gave up Spring, I can only use Servlet to develop web
applications in OSGi. So, I need to do a lot of work to implement a wrapper
similar to the SpringMVC framework.

Is there any other good advice, or can subsequent versions of Karaf provide
a framework that can replace SpringMVC instead of using the original
servlet?


Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi Duan,

Karaf doesn't gave up Spring, it's still available.

In your bundle, you can still use Spring MVC DispatcherServlet, wiring, etc.

Spring DM is also still available but you have to use old Spring
version: it's not due to Karaf, it's Spring that doesn't maintain Spring
DM anymore.
So, my advice was more to replace Spring DM.

Without some details about your use of Spring MVC and the way you
package it in your bundles, I can only do suggestion.
Don't hesitate to ping me with some details.

Regards
JB

On 09/11/2019 04:27, duan2ping wrote:

> Hi JB
>
>
> Because karaf gave up Spring, I can only use Servlet to develop web
> applications in OSGi. So, I need to do a lot of work to implement a wrapper
> similar to the SpringMVC framework.
>
> Is there any other good advice, or can subsequent versions of Karaf provide
> a framework that can replace SpringMVC instead of using the original
> servlet?
>
>
> Regards
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Hi JB

First of all, thank you very much for your suggestions and reply.

This is my Web Bundle I want to transform. ob-web.gz
<http://karaf.922171.n3.nabble.com/file/t498132/ob-web.gz>  

It is based on karaf3.0.8 and spring3.2.14. I am trying to upgrade karaf and
spring.
But unfortunately found that the new version of karaf does not support
SpringDM and can no longer use SpringMVC. Although Karaf retains
spring-legacy, it should not be a good solution.

The problem I am facing now is:

* If i want to continue using SpringMVC, because Spring no longer maintains
SpringDM, I can only use the old version (Spring has stopped maintenance, I
think I should not be using it.)

* If i drop SpringMVC, what are the alternatives in Karaf? (Blueprint, SCR)
But Blueprint seems to only use the original Servlet, which will cause me to
do a lot of work. Because I need a good framework like SpringMVC.

What should I do? Since Spring is not maintaining, the best solution now is
to use Servlets?

Thanks again
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi,

As said early, you can do the same as in Karaf 3.0.8 with Karaf 4.2.x if
you first add spring-legacy features repository: it still provides
Spring 3.2.14 and spring-dm.

Just do feature:repo-add spring-legacy.

Regards
JB

On 11/11/2019 04:42, duan2ping wrote:

> Hi JB
>
> First of all, thank you very much for your suggestions and reply.
>
> This is my Web Bundle I want to transform. ob-web.gz
> <http://karaf.922171.n3.nabble.com/file/t498132/ob-web.gz>  
>
> It is based on karaf3.0.8 and spring3.2.14. I am trying to upgrade karaf and
> spring.
> But unfortunately found that the new version of karaf does not support
> SpringDM and can no longer use SpringMVC. Although Karaf retains
> spring-legacy, it should not be a good solution.
>
> The problem I am facing now is:
>
> * If i want to continue using SpringMVC, because Spring no longer maintains
> SpringDM, I can only use the old version (Spring has stopped maintenance, I
> think I should not be using it.)
>
> * If i drop SpringMVC, what are the alternatives in Karaf? (Blueprint, SCR)
> But Blueprint seems to only use the original Servlet, which will cause me to
> do a lot of work. Because I need a good framework like SpringMVC.
>
> What should I do? Since Spring is not maintaining, the best solution now is
> to use Servlets?
>
> Thanks again
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Hi JB

Although Karaf retains spring-legacy, but it should not be a good solution.
Spring has stopped maintenance, I think I should not be using it.

It seems that I want to use the new version of Spring in Karaf is not very
likely. That's a shame, I have to say goodbye to Spring. At present, there
is no Web framework that can replace SpringMVC in Karaf. Can I only use
Servlet?

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi Duan,

I fully agree with you ;)

You can use new Spring version (it works fine), but not with Spring DM
(as spring dm only works with Spring 3.x).
That's why I proposed to refactore either using Spring MVC (and the
Dispatcher servlet) or directly using your own controller servlet
serving frontend like Angular based.

Regards
JB

On 11/11/2019 06:53, duan2ping wrote:

> Hi JB
>
> Although Karaf retains spring-legacy, but it should not be a good solution.
> Spring has stopped maintenance, I think I should not be using it.
>
> It seems that I want to use the new version of Spring in Karaf is not very
> likely. That's a shame, I have to say goodbye to Spring. At present, there
> is no Web framework that can replace SpringMVC in Karaf. Can I only use
> Servlet?
>
> Regards
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Hi JB

You said that I can use the new SpringMVC, but I can't use SpringDM.

I don't know much about SpringDM(SpringDM is a Spring module that implements
Spring's interaction with OSGi contexts and acquires or publishes OSGi
services.).

I understand that Spring DM is required in karaf to use Spring, isn't it?

Although I can use the new SpringMVC normally in Karaf, but without
SpringDM, can I get the OSGi service in SpringMVC?

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

jbonofre
Hi,

Spring DM is only required if you want to inject OSGi service in your
Spring application context.
If you want to inject OSGi services, you can create your own bean using
bundleContext.
I have in mind to provide a Spring controller, and it's almost already
done in Aries Blueprint AFAIR (I have to check).

Regards
JB

On 11/11/2019 07:37, duan2ping wrote:

> Hi JB
>
> You said that I can use the new SpringMVC, but I can't use SpringDM.
>
> I don't know much about SpringDM(SpringDM is a Spring module that implements
> Spring's interaction with OSGi contexts and acquires or publishes OSGi
> services.).
>
> I understand that Spring DM is required in karaf to use Spring, isn't it?
>
> Although I can use the new SpringMVC normally in Karaf, but without
> SpringDM, can I get the OSGi service in SpringMVC?
>
> Regards
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using SpringMVC in Karaf 4.2.6

duan2ping
Hi JB

Good Job!
With it, I can use Spring perfectly in karaf, right?
When can I see it.

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html