What is EJB alternative in Spring Framework

前端 未结 3 1161
孤独总比滥情好
孤独总比滥情好 2021-02-10 02:53

I am trying to learn Spring Framework, before that I used to create application with EJBs

[Web services]->[Business Layer]->[DAO Layer] | [Database]

3条回答
  •  -上瘾入骨i
    2021-02-10 03:51

    • Jersey (RestAPi) alternative in Spring ⇨ it's rest api (in spring with @Path annotation) or spring mvc if you want to use controllers (@Controller annotation)!
    • EJB alternative in Spring ⇨ Spring doesn't give statefull bean out of a box but you can use @Service annotation (or @Repository for DAO) but you have to handle transactions manually (with annotations for example)
    • Message Drive Bean alternative ⇨ There is no equivalent out of the box in Spring, you could use injection and librairies of Spring to get it working (package org.springframework.jms should contains what you need)!
    • JPA(entity manager) alternative is not ejb ⇨ so it can be used in Spring.

    Spring is a lighweight library so you can do all you do with EJB but it's more configurable so you will have more work to do the same that EJB do. But this configuration brings you some advantages: you have the hand on it!

提交回复
热议问题