AbstractEntityModel.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:OpERP 作者:
@PostConstruct
public void registerWithServer() {
    AutowireCapableBeanFactory factory = context
            .getAutowireCapableBeanFactory();
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) factory;
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClass(RmiServiceExporter.class);
    beanDefinition.setAutowireCandidate(true);

    MutablePropertyValues propertyValues = new MutablePropertyValues();

    Class<?> serviceInterface = this.getClass().getInterfaces()[0];

    propertyValues.addPropertyValue("serviceInterface", serviceInterface);
    String serviceName = serviceInterface.getCanonicalName();
    propertyValues.addPropertyValue("serviceName", serviceName);
    propertyValues.addPropertyValue("service", this);
    propertyValues.addPropertyValue("registryPort", "1099");
    beanDefinition.setPropertyValues(propertyValues);

    registry.registerBeanDefinition(serviceName, beanDefinition);
    context.getBean(serviceName); // Need this else
                                    // NotBoundException
    getService().registerClient(getHostAddress());

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号