Java EE Structure
******************************************************************************** com.airhacks javaee7-essentials-archetype http://repo.maven.apache.org/maven2/ 1.3 ******************************************************************************** package boundary; import javax.ejb.Stateless; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; @Stateless @Path("speakers") public class SpeakerResource { @Inject SpeakersManager manager; @GET public void all(@Suspended AsyncResponse response) { response.resume(manager.all()); } /* @GET public String all() { return manager.all(); } */ } ******************************************************************************** package boundary; import control.Check; import javax.ejb.Stateless; import javax.inject.Inject; @Stateless public class SpeakersManager { @Inject Check check; @Inject String secretMessage; public String all() { return secretMessage + "enterprice duke" + check.sellingFatJars(); } } ******************************************************************************** package control; public class Check { public boolean sellingFatJars() { return false; } } ******************************************************************************** package configration.boundary; import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; public class Configurator { @Produces public String exposes(InjectionPoint ip) { String clazz = ip.getMember().getDeclaringClass().getName(); String name = ip.getMember().getName(); return clazz + "--->" + name; //return "hey kale anka with lots fikka"; } } ******************************************************************************** package com.airhacks; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; /** * Configures a JAX-RS endpoint. Delete this class, if you are not exposing * JAX-RS resources in your application. * * @author airhacks.com */ @ApplicationPath("resources") public class JAXRSConfiguration extends Application { } ******************************************************************************** pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.compcoding</groupId> <artifactId>testweb2</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>testweb2</finalName> </build> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> </properties> </project> ********************************************************************************


@2024