All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.reactive.common.reflection.ReflectionBeanFactory Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package org.jboss.resteasy.reactive.common.reflection;

import org.jboss.resteasy.reactive.spi.BeanFactory;

public class ReflectionBeanFactory implements BeanFactory {
    private final String className;

    public ReflectionBeanFactory(String className) {
        this.className = className;
    }

    @Override
    public BeanInstance createInstance() {
        try {
            T instance = (T) Class.forName(className, false, Thread.currentThread().getContextClassLoader())
                    .getDeclaredConstructor()
                    .newInstance();
            return new BeanInstance() {
                @Override
                public T getInstance() {
                    return instance;
                }

                @Override
                public void close() {

                }
            };
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy