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
4.0.0
com.compcoding
testweb2
1.0-SNAPSHOT
war
javax
javaee-api
7.0
provided
testweb2
1.8
1.8
false
********************************************************************************