Giter Site home page Giter Site logo

local-ejb-injection's Introduction

local-ejb-injection

This is a sample project demonstrating injecting EJBs from EJB JARs into web applications packaged as WARs inside a master EAR.

Here's how the result looks:

application-ear.ear
├── service-ejb-impl.jar
├── web-application.war
├── lib
│   └── service-ejb-api.jar
└── META-INF
    ├── MANIFEST.MF
    └── application.xml

Here’s a usage scenario:

You have a web application packaged as a WAR that needs to use EJB services that cannot be packaged into the WAR as they are used by other WARs in the EAR. You annotate the service interface with @Local, extract it into a separate API JAR and reference the API JAR from both the WAR and EAR projects. Then you implement the service in an EJB JAR that is packaged into the EAR and inject the interface with @EJB annotation as an instance field into a servlet in the WAR.

It’s a Maven project with the following modules:

  • web-application – servlet that calls the EJB service, open http://localhost:8080/web-application/hello to access it
  • service-ejb-api – service interface with @Local annotation
  • service-ejb-impl@Stateless EJB that implements the service interface
  • application-ear – packages the EJB JAR into an EAR.

Build it with mvn package and deploy application-ear/target/application-ear.ear to the application server to run it.

local-ejb-injection's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.