Java 类org.springframework.context.ApplicationContext 实例源码

项目:spring-reactive-sample    文件:Application.java   
@Bean
public Server jettyServer(ApplicationContext context) throws Exception {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    Servlet servlet = new JettyHttpHandlerAdapter(handler);

    Server server = new Server();
    ServletContextHandler contextHandler = new ServletContextHandler(server, "");
    contextHandler.addServlet(new ServletHolder(servlet), "/");
    contextHandler.start();

    ServerConnector connector = new ServerConnector(server);
    connector.setHost("localhost");
    connector.setPort(port);
    server.addConnector(connector);

    return server;
}
项目:EasyHousing    文件:TestBuildingDealDao.java   
@Test
public void Test4(){
    ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");//��ʼ������
    BuildingDealDao buildingDealDao = (BuildingDealDao) ac.getBean("buildingDealDao");
    BuildingDeal u = new BuildingDeal();
    u.setAgentId(2);
    u.setBuildingDealPerPrice(100);
    u.setBuildingDealTime(new Date());
    u.setBuildingDealTotalPrice(100);
    u.setBuildingId(1);
    u.setBuildingLayout("111��һ��");
    u.setUserId(1);
    u.setBuildingDealId(1);
    buildingDealDao.deleteBuildingDeal(u);
    System.out.println(u.getBuildingLayout());
}
项目:springboot-shiro-cas-mybatis    文件:AbstractServletContextInitializer.java   
@Override
public final void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    this.applicationContext = applicationContext;

    try {
        logger.info("Initializing {} root application context", contextInitializerName);
        initializeRootApplicationContext();
        logger.info("Initialized {} root application context successfully", contextInitializerName);

        logger.info("Initializing {} servlet application context", contextInitializerName);
        initializeServletApplicationContext();
        logger.info("Initialized {} servlet application context successfully", contextInitializerName);
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }
}
项目:plugin-id    文件:UserBatchLdapResourceTest.java   
@SuppressWarnings("unchecked")
@Before
public void mockApplicationContext() {
    final ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
    SpringUtils.setSharedApplicationContext(applicationContext);
    mockLdapResource = Mockito.mock(UserOrgResource.class);
    final UserFullLdapTask mockTask = new UserFullLdapTask();
    mockTask.resource = mockLdapResource;
    mockTask.securityHelper = securityHelper;
    final UserAtomicLdapTask mockTaskUpdate = new UserAtomicLdapTask();
    mockTaskUpdate.resource = mockLdapResource;
    mockTaskUpdate.securityHelper = securityHelper;
    Mockito.when(applicationContext.getBean(SessionSettings.class)).thenReturn(new SessionSettings());
    Mockito.when(applicationContext.getBean((Class<?>) ArgumentMatchers.any(Class.class))).thenAnswer((Answer<Object>) invocation -> {
        final Class<?> requiredType = (Class<Object>) invocation.getArguments()[0];
        if (requiredType == UserFullLdapTask.class) {
            return mockTask;
        }
        if (requiredType == UserAtomicLdapTask.class) {
            return mockTaskUpdate;
        }
        return UserBatchLdapResourceTest.super.applicationContext.getBean(requiredType);
    });

    mockTaskUpdate.jaxrsFactory = ServerProviderFactory.createInstance(null);
}
项目:alfresco-repository    文件:AlfrescoPeople.java   
@Override protected void after()
{
    // Set up required services
    ApplicationContext ctxt = getApplicationContext();
    final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) ctxt.getBean("retryingTransactionHelper");

    transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override public Void execute() throws Throwable
        {
            for (Map.Entry<String, NodeRef> entry : usersPersons.entrySet())
            {
                deletePerson(entry.getKey());
            }

            return null;
        }
    });
}
项目:learn-spring-5    文件:LearnspringdiApplication.java   
public static void main(String[] args) {

        ApplicationContext ctx =  SpringApplication.run(LearnspringdiApplication.class, args);

        //Always the bean name will be equivalent to the class name (but starts with lowercase)
        FirstController controller = (FirstController) ctx.getBean("firstController");
        System.out.println(controller.sayHello());
        System.out.println(ctx.getBean(PropertyInjectController.class).sayHello());
        System.out.println(ctx.getBean(SetterInjectController.class).sayHello());
        System.out.println(ctx.getBean(ConstructorInjectController.class).sayHello());

        TestDataSource testDataSource = (TestDataSource) ctx.getBean(TestDataSource.class);
        System.out.println("Reading value from external Property File :"+ testDataSource.getDbUrl());

        TestEnvProp testEnvProp = (TestEnvProp) ctx.getBean(TestEnvProp.class);
        System.out.println("Accessed System value through Spring Environmet Variable "+testEnvProp.getSystemUserName());
        System.out.println("Accessed System value directly via Spring @Value Annotation :"+testEnvProp.JAVA_VERSION);

        TestJmsBroker testJmsBroker = (TestJmsBroker) ctx.getBean(TestJmsBroker.class);
        System.out.println("Accessed multiple property file values using @PropertySources :"+testJmsBroker.getJmsUrl());
    }
项目:urule    文件:BaseRepositoryService.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    try {
        repository = repositoryBuilder.getRepository();
        SimpleCredentials cred = new SimpleCredentials("admin", "admin".toCharArray());
        cred.setAttribute("AutoRefresh", true);
        session = repository.login(cred, null);
        versionManager = session.getWorkspace().getVersionManager();
        lockManager=session.getWorkspace().getLockManager();
        Collection<RepositoryInteceptor> repositoryInteceptors=applicationContext.getBeansOfType(RepositoryInteceptor.class).values();
        if(repositoryInteceptors.size()==0){
            repositoryInteceptor=new DefaultRepositoryInteceptor();
        }else{
            repositoryInteceptor=repositoryInteceptors.iterator().next();
        }
    } catch (Exception ex) {
        throw new RuleException(ex);
    }
}
项目:lams    文件:ContextBeanFactoryReference.java   
@Override
public void release() {
    if (this.applicationContext != null) {
        ApplicationContext savedCtx;

        // We don't actually guarantee thread-safety, but it's not a lot of extra work.
        synchronized (this) {
            savedCtx = this.applicationContext;
            this.applicationContext = null;
        }

        if (savedCtx != null && savedCtx instanceof ConfigurableApplicationContext) {
            ((ConfigurableApplicationContext) savedCtx).close();
        }
    }
}
项目:EasyHousing    文件:TestBuildingLayoutDao.java   
@Test
public void Test2(){
    ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");//��ʼ������
    BuildingLayoutDao buildingLayoutDao = (BuildingLayoutDao) ac.getBean("buildingLayoutDao");
    BuildingLayout u = new BuildingLayout();

    u.setBuildingId(2);
    u.setBuildingLayout("һ��һ��");
    u.setBuildingLayoutPerPrice(2);
    u.setBuildingLayoutPicUrl("2112512");
    u.setBuildingLayoutReferencePrice(2);
    u.setBuildingLayoutSoldOut(2);

    buildingLayoutDao.updateBuildingLayout(u);

    System.out.println("-------");
}
项目:cstruct-parser    文件:AbstractResolve.java   
@Override
public void refresh(ApplicationContext applicationContext)
{
    unResolvePostProcessList = new ArrayList<>();

    Map<String, UnResolvePostProcess> unResolvePostProcessMap = applicationContext.getBeansOfType(UnResolvePostProcess.class);

    if (!CollectionUtils.isEmpty(unResolvePostProcessMap)) {
        unResolvePostProcessList.addAll(unResolvePostProcessMap.values());
    }
    unResolvePostProcessMap = null;

    unResolveFieldPostProcessList = new ArrayList<>();

    Map<String, UnResolveFieldPostProcess> unResolveFieldPostProcessMap = applicationContext.getBeansOfType(UnResolveFieldPostProcess.class);

    if (!CollectionUtils.isEmpty(unResolveFieldPostProcessMap)) {
        unResolveFieldPostProcessList.addAll(unResolveFieldPostProcessMap.values());
    }
    unResolveFieldPostProcessMap = null;

}
项目:spring-reactive-sample    文件:Application.java   
public static void main(String[] args) throws Exception {
    ApplicationContext context = new AnnotationConfigApplicationContext(Application.class);  // (1)

    Tomcat tomcatServer = context.getBean(Tomcat.class);
    tomcatServer.start();

    System.out.println("Press ENTER to exit.");
    System.in.read();
}
项目:EasyHousing    文件:RentHousePicTest.java   
@Test
public void select() {
    ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
    RentHousePicDao dao = (RentHousePicDao) ac.getBean("rentHousePicDao");
    RentHousePic c = new RentHousePic();
    c.setRentHousePicId(2);
    System.out.println(dao.selectRentHousePic(c).getPicUrl());
}
项目:JavaStudy    文件:App.java   
@Test
public void test(){
    ApplicationContext atc=new AnnotationConfigApplicationContext(SystemXml.class);
    SystemXmlMap map=(SystemXmlMap)atc.getBean("systemXmlMap");
    PrinterUtils.printILog(map.toString());

    Environment environment=(Environment)atc.getBean("environment");
    PrinterUtils.printILog(environment.getProperty("username"));
}
项目:item-shop-reactive-backend    文件:Server.java   
@Bean(name="serverBrowse")
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create(host, port);
    return httpServer.newHandler(adapter).block();
}
项目:xxl-job    文件:XxlJobDynamicScheduler.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    XxlJobDynamicScheduler.xxlJobLogDao = applicationContext.getBean(IXxlJobLogDao.class);
    XxlJobDynamicScheduler.xxlJobInfoDao = applicationContext.getBean(IXxlJobInfoDao.class);
       XxlJobDynamicScheduler.xxlJobRegistryDao = applicationContext.getBean(IXxlJobRegistryDao.class);
       XxlJobDynamicScheduler.xxlJobGroupDao = applicationContext.getBean(IXxlJobGroupDao.class);
}
项目:springmock    文件:ApplicationContextWalkerTest.java   
@Test
public void should_detect_duplicated_beans_of_the_same_type_on_the_same_level() {
    //given
    class Bean {}
    final ApplicationContext ctx = buildAppContext(Stream.of(
            bean("1", new Bean()),
            bean("2", new Bean())));
    final ApplicationContextWalker walker = new ApplicationContextWalker(ctx);

    //expect
    assertFalse(walker.hasOnlyOneBeanOfClass(Bean.class));
}
项目:spring-boot-starter-quartz    文件:QuartzSchedulerAutoConfiguration.java   
private Properties loadConfigLocationProperties(ApplicationContext applicationContext, 
        QuartzSchedulerProperties properties) throws IOException {

    String location = properties.getPropertiesConfigLocation();
    if(null == location || location.trim().length() == 0) {
        location = QuartzSchedulerProperties.DEFAULT_CONFIG_LOCATION;
        LOGGER.debug("using default 'quartz.properties' from classpath: " + location);
    } else {
        LOGGER.debug("using 'quartz.properties' from location: " + location);
    }
    PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
    propertiesFactoryBean.setLocation(applicationContext.getResource(location));
    propertiesFactoryBean.afterPropertiesSet();
    return propertiesFactoryBean.getObject();
}
项目:alfresco-remote-api    文件:ReplicationRestApiTest.java   
@Override
protected void setUp() throws Exception
{
    super.setUp();
    ApplicationContext appContext = getServer().getApplicationContext();

    nodeService = (NodeService)appContext.getBean("NodeService");
    replicationService = (ReplicationService)appContext.getBean("ReplicationService");
    actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
    repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
    transactionService = (TransactionService)appContext.getBean("transactionService");

    MutableAuthenticationService authenticationService = (MutableAuthenticationService)appContext.getBean("AuthenticationService");
    PersonService personService = (PersonService)appContext.getBean("PersonService");
    personManager = new TestPersonManager(authenticationService, personService, nodeService);

    UserTransaction txn = transactionService.getUserTransaction();
    txn.begin();

    personManager.createPerson(USER_NORMAL);

    // Ensure we start with no replication definitions
    // (eg another test left them behind)
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
       replicationService.deleteReplicationDefinition(rd);
    }
    txn.commit();

    // Grab a reference to the data dictionary
    dataDictionary = nodeService.getChildByName(
             repositoryHelper.getCompanyHome(),
             ContentModel.ASSOC_CONTAINS,
             "Data Dictionary"
    );

    AuthenticationUtil.clearCurrentSecurityContext();
}
项目:Learning-Spring-5.0    文件:TestCustomer.java   
public static void main(String[] args) {
    // TODO Auto-generated method stub
    ApplicationContext context=new ClassPathXmlApplicationContext("customer.xml");
    Customer customer=(Customer)context.getBean("customer");
    System.out.println(customer.getCust_name()+"\t"+customer.getCust_id());
       System.out.println(customer.getCust_address());   
}
项目:plugin-id    文件:UserOrgResourceTest.java   
@Test
public void resetPasswordByAdmin() {
    resource.applicationContext = Mockito.mock(ApplicationContext.class);
    final IPasswordGenerator generator = Mockito.mock(IPasswordGenerator.class);
    Mockito.when(resource.applicationContext.getBeansOfType(IPasswordGenerator.class)).thenReturn(Collections.singletonMap("bean", generator));
    resource.resetPasswordByAdmin(newUser());
    Mockito.verify(generator, VerificationModeFactory.atLeast(1)).generate("wuser");
}
项目:Spring-Security-Third-Edition    文件:CalendarApplication.java   
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

        System.out.println("Let's inspect the beans provided by Spring Boot:\n");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }

        System.out.println("---");
    };
}
项目:vertx-spring-boot-example    文件:SpringDeploymentManager.java   
@Autowired
SpringDeploymentManager(
        final ApplicationContext context,
        final VerticleFactory verticleFactory,
        final Vertx vertx,
        @Value("${thread.pool.size}") final int threadPoolSize
) {
    this.context = context;
    this.verticleFactory = verticleFactory;
    this.vertx = vertx;
    this.threadPoolSize = getThreadPoolSize(threadPoolSize);
}
项目:ARCLib    文件:Gatherer.java   
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new LinkedHashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
项目:lams    文件:WebApplicationObjectSupport.java   
/**
 * Return the current application context as WebApplicationContext.
 * <p><b>NOTE:</b> Only use this if you actually need to access
 * WebApplicationContext-specific functionality. Preferably use
 * {@code getApplicationContext()} or {@code getServletContext()}
 * else, to be able to run in non-WebApplicationContext environments as well.
 * @throws IllegalStateException if not running in a WebApplicationContext
 * @see #getApplicationContext()
 */
protected final WebApplicationContext getWebApplicationContext() throws IllegalStateException {
    ApplicationContext ctx = getApplicationContext();
    if (ctx instanceof WebApplicationContext) {
        return (WebApplicationContext) getApplicationContext();
    }
    else if (isContextRequired()) {
        throw new IllegalStateException("WebApplicationObjectSupport instance [" + this +
                "] does not run in a WebApplicationContext but in: " + ctx);
    }
    else {
        return null;
    }
}
项目:incubator-servicecomb-java-chassis    文件:MockUtil.java   
public void mockBeanUtils() {

    new MockUp<BeanUtils>() {
      @Mock
      ApplicationContext getContext() {
        return Mockito.mock(ApplicationContext.class);
      }
    };
  }
项目:ureport    文件:DefaultImageProvider.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    if(applicationContext instanceof WebApplicationContext){
        WebApplicationContext context=(WebApplicationContext)applicationContext;
        baseWebPath=context.getServletContext().getRealPath("/");
    }
    this.applicationContext=applicationContext;
}
项目:alfresco-repository    文件:FFCLoadsOfFiles.java   
public static void main(String[] args)
{

    // initialise app content 
    ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
    // get registry of services
    final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

    // authenticate
    AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
    authenticationService.authenticate(AuthenticationUtil.getAdminUserName(), "admin".toCharArray());


    // use TransactionWork to wrap service calls in a user transaction
    TransactionService transactionService = serviceRegistry.getTransactionService();
    RetryingTransactionCallback<Object> exampleWork = new RetryingTransactionCallback<Object>()
    {
        public Object execute() throws Exception
        {
            doExample(serviceRegistry);
            return null;
        }
    };
    currentDoc = 0;
    while (currentDoc < totalNumDocs)
    {
        transactionService.getRetryingTransactionHelper().doInTransaction(exampleWork);
    }
    System.exit(0);
}
项目:daros-dynamic    文件:DynamicRegisterGroovyFile.java   
@Autowired
public void setApplicationContext(ApplicationContext ctx) {
    if (!DefaultListableBeanFactory.class.isAssignableFrom(ctx.getAutowireCapableBeanFactory().getClass())) {
        throw new IllegalArgumentException("BeanFactory must be DefaultListableBeanFactory type");
    }
    this.ctx = ctx;
    this.beanFactory = (DefaultListableBeanFactory) ctx.getAutowireCapableBeanFactory();
}
项目:urule    文件:CacheUtils.java   
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    Collection<KnowledgeCache> caches=applicationContext.getBeansOfType(KnowledgeCache.class).values();
    if(caches.size()>0){
        CacheUtils.knowledgeCache=caches.iterator().next();
    }else{
        CacheUtils.knowledgeCache=new MemoryKnowledgeCache();
    }
}
项目:spring-web-services    文件:SpringbootIn10StepsApplication.java   
public static void main(String[] args) {
    ApplicationContext applicationContext = 
            SpringApplication.run(SpringbootIn10StepsApplication.class, args);

    for (String name : applicationContext.getBeanDefinitionNames()) {
        System.out.println(name);
    }
}
项目:albedo-thrift    文件:AlbedoThriftExampleClient.java   
/**
 * Main method, used to run the application.
 *
 * @param args the command line arguments
 * @throws UnknownHostException if the local host name could not be resolved into an address
 */
public static void main(String[] args) throws Exception {
    SpringApplication app = new SpringApplication(AlbedoThriftExampleClient.class);
    final ApplicationContext applicationContext = app.run(args);
    Environment env = applicationContext.getEnvironment();
    log.info("\n----------------------------------------------------------\n\t" +
                    "Application '{}' is running! ",
            env.getProperty("spring.application.name"));
}
项目:aaden-pay    文件:SpringContextHelper.java   
/**
 * 实现ApplicationContextAware接口, 注入Context到静态变量中.
 */
public void setApplicationContext(ApplicationContext applicationContext) {
    logger.debug("set applicationContext to springContextHolder:" + applicationContext);
    if (SpringContextHelper.applicationContext != null) {
        logger.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHelper.applicationContext);
    }
    SpringContextHelper.applicationContext = applicationContext; // NOSONAR
}
项目:springboot-sample    文件:Application.java   
public static void main(String[] args) throws InterruptedException {

        ApplicationContext app = SpringApplication.run(Application.class, args);

        while (true) {
            Sender sender = app.getBean(Sender.class);
            sender.sendMessage();
            Thread.sleep(5000);
        }
    }
项目:spring-reactive-sample    文件:Application.java   
@Profile("default")
@Bean
public NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", this.port);
    return httpServer.newHandler(adapter).block();
}
项目:hibatis    文件:InsertTest.java   
@Before
public void init(){
    @SuppressWarnings("resource")
    ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
    SqlSessionFactory sqlSessionFactory =  context.getBean(SqlSessionFactory.class);
    sqlMapper = new SqlMapperTemplate(sqlSessionFactory);
}
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9008"));
    return httpServer.newHandler(adapter).block();
}
项目:autotest    文件:AutoTestExtension.java   
static Object resolveDependency(Parameter parameter, Class<?> containingClass, ApplicationContext applicationContext) {
    boolean required = findMergedAnnotation(parameter, Autowired.class).map(Autowired::required).orElse(true);
    MethodParameter methodParameter = SynthesizingMethodParameter.forParameter(parameter);
    DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required);
    descriptor.setContainingClass(containingClass);
    return applicationContext.getAutowireCapableBeanFactory().resolveDependency(descriptor, null);
}
项目:lams    文件:Patch0012FixWorkspaceNames.java   
private String getI18nMessage(Connection conn) throws MigrationException {
// get spring bean
ApplicationContext context = new ClassPathXmlApplicationContext("org/lamsfoundation/lams/messageContext.xml");
MessageService messageService = (MessageService) context.getBean("commonMessageService");

// get server locale
String defaultLocale = "en_AU";
String getDefaultLocaleStmt = "select config_value from lams_configuration where config_key='ServerLanguage'";
try {
    PreparedStatement query = conn.prepareStatement(getDefaultLocaleStmt);
    ResultSet results = query.executeQuery();
    while (results.next()) {
    defaultLocale = results.getString("config_value");
    }
} catch (Exception e) {
    throw new MigrationException("Problem running update; ", e);
}

String[] tokenisedLocale = defaultLocale.split("_");
Locale locale = new Locale(tokenisedLocale[0], tokenisedLocale[1]);

// get i18n'd message for text 'run sequences'
MessageSource messageSource = messageService.getMessageSource();
String i18nMessage = messageSource.getMessage("runsequences.folder.name", new Object[] { "" }, locale);

if (i18nMessage != null && i18nMessage.startsWith("???")) {
    // default to English if not present
    return " Run Sequences";
}
return i18nMessage;
   }
项目:Spring-5.0-Cookbook    文件:HttpServerConfig.java   
@Bean
public  NettyContext nettyContext(ApplicationContext context) {
    HttpHandler handler = DispatcherHandler.toHttpHandler(context);
    ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
    HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8908"));
    return httpServer.newHandler(adapter).block();
}