有人使用 Vaadin @Push 和 vaadin-spring-boot-starter 和 Vaadin4Spring 安全扩展吗?
这是我们项目中与 Vaadin 相关的依赖项:
compile 'com.vaadin:vaadin-client-compiled:7.5.8'
compile 'com.vaadin:vaadin-client:7.5.8'
compile 'com.vaadin:vaadin-themes:7.5.8'
compile 'com.vaadin:vaadin-server:7.5.8'
compile 'com.vaadin:vaadin-push:7.5.8'
// Official VaadinSpring Integration
compile("com.vaadin:vaadin-spring-boot-starter:1.0.0")
//Vaadin extentions - in the future more of those will go to official VaadinSpring Integration
compile("org.vaadin.spring.extensions:vaadin-spring-ext-security:0.0.6.RELEASE")
compile("org.vaadin.spring.extensions:vaadin-spring-ext-core:0.0.6.RELEASE")
compile("org.vaadin.spring.extensions:vaadin-spring-ext-boot:0.0.6.RELEASE")
compile("org.vaadin.spring.extensions:vaadin-spring-ext-test:0.0.6.RELEASE")
这是关于 UI 类的注释
@Theme("mytheme")
@Title(com.test.util.Constants.TITLE)
@EnableOAuth2Client
@SpringUI
@Push
public class MyVaadinUI extends UI {
...
}
并且,Application.java;
@EnableVaadinExtensions
@SpringBootApplication
@EnableConfigurationProperties
@EnableI18N
@EnableEventBus
@RestController
@EnableOAuth2Client
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
@Bean
public RequestContextListener requestContextListener(){
return new RequestContextListener();
}
@Bean
public FilterRegistrationBean hiddenHttpMethodFilter() {
HiddenHttpMethodFilter hiddenHttpMethodFilter = new HiddenHttpMethodFilter();
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(hiddenHttpMethodFilter);
return registrationBean;
}
@Bean(name = "messageSource")
public ResourceBundleMessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages/messages");
logger.debug("Returning messageSource: " + ((messageSource != null) ? messageSource.toString() : "NULL"));
return messageSource;
}
}
一旦我们调用 security.login(username.getValue(), password.getValue()); (安全是 org.vaadin.spring.security.VaadinSecurity;)
我们得到以下异常;
16:36:35.272 [http-nio-8080-exec-9] 错误 cbgcsvviews.login.LoginBox/login 在 login.org.springframework.beans.factory.BeanCreationException 期间发生登录错误:创建名称为“scopedTarget.httpService”的 bean 时出错:范围“请求”对当前线程不活动;如果您打算从单例中引用它,请考虑为该 bean 定义一个作用域代理;嵌套异常是 java.lang.IllegalStateException:未找到线程绑定请求:您是指实际 Web 请求之外的请求属性,还是在原始接收线程之外处理请求?如果您实际上是在 Web 请求中操作并且仍然收到此消息,则您的代码可能在 DispatcherServlet/DispatcherPortlet 之外运行:在这种情况下,
感谢您提供的任何帮助。