paulwong

在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);
    }
}

posted on 2014-02-12 16:43 paulwong 阅读(392) 评论(0)  编辑  收藏 所属分类: SPRINGEJB3


只有注册用户登录后才能发表评论。


网站导航: