我正在使用dropwizard框架开发REST apis
我已经成功地将Spring Security集成到了dropwizard项目中,它就像一个魅力 .
不幸的是,我还没能让Spring Session与dropwizard一起工作 .

我已经按照指南使用了Spring会话Spring SecurityRest,没有创建会话或者看到任何http-header,即使我可以看到在dropwizard日志中初始化的Spring会话配置

INFO [2016-01-21 04:05:53,326] org.springframework.beans.factory.support.DefaultListableBeanFactory:覆盖bean'httpSessionStrategy'的bean定义:替换[Root bean:class [null];范围=;抽象= FALSE; lazyInit = FALSE; autowireMode = 3; dependencyCheck = 0; autowireCandidate = TRUE;初级= FALSE; factoryBeanName = springSecurityConfig; factoryMethodName = httpSessionStrategy; initMethodName = NULL; destroyMethodName =(推断);在com.cr.security.SpringSecurityConfig中定义[Root bean:class [null];范围=;抽象= FALSE; lazyInit = FALSE; autowireMode = 3; dependencyCheck = 0; autowireCandidate = TRUE;初级= FALSE; factoryBeanName = springSessionConfig; factoryMethodName = httpSessionStrategy; initMethodName = NULL; destroyMethodName =(推断);在com.cr.security.SpringSessionConfig中定义]

使用dropwizard注册Spring会话的正确方法是什么,我需要帮助将spring会话与dropwizard绑定 .

EDIT :我添加了一个将spring-security集成到dropwizard中的示例 .
Github Repository

这是将 spring 安全性连接到dropwizard的代码部分 .

//initialize spring context
    AnnotationConfigWebApplicationContext parent=new AnnotationConfigWebApplicationContext();
    AnnotationConfigWebApplicationContext ctx=new AnnotationConfigWebApplicationContext();

    parent.refresh();
    parent.getBeanFactory().registerSingleton("configuration", configuration);
    parent.registerShutdownHook();
    parent.start();

    //real main app context has to link to parent context
    ctx.setParent(parent);
    ctx.register(SecurityConfig.class);

    //scan all APIS
    ctx.scan("com.poc.dropwizard");
    ctx.scan("com.poc.spring");

    ctx.refresh();
    ctx.registerShutdownHook();
    ctx.start();

    //link spring to embedded jetty
    environment.servlets().addServletListeners(new ContextLoaderListener(ctx));

    //activate spring security filter
    Dynamic filterRegistration=environment.servlets().addFilter("springSecurityFilterChain",DelegatingFilterProxy.class);
    filterRegistration.setInitParameter("listener-class", ContextLoaderListener.class.toString());
    filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*");

这是我不确定如何强制jetty-dropwizard使用spring-session的部分

//link spring-session to embedded jetty
    //TODO - link spring session 
    environment.servlets().setSessionHandler(new SessionHandler());