在EJB3的SESSION BEAN中使用SPRING BEAN

在EJB3的SESSION BEAN中使用SPRING BEAN

EJB3 façade over Spring services
http://java.dzone.com/articles/ejb3-fa%C3%A7ade-over-spring


Using Spring’s EJB implementation support classes
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/ejb.html#ejb-implementation-ejb3



import javax.ejb.Stateless;
import javax.interceptor.Interceptors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor;

import ch.frankel.blog.ejb.spring.service.client.RandomGeneratorService;

@Stateless
@Interceptors(SpringBeanAutowiringInterceptor. class)
public  class RandomGeneratorBean  implements RandomGeneratorService {

    @Autowired
     private ch.frankel.blog.ejb.spring.service.RandomGeneratorService delegate;

    @Override
     public  int generateNumber( int lowerLimit,  int upperLimit) {

         return delegate.generateNumber(lowerLimit, upperLimit);
    }
}

你可能感兴趣的:(在EJB3的SESSION BEAN中使用SPRING BEAN)