首页 文章

VaadinSession在Spring Boot应用程序中失败

提问于
浏览
0

我认为那很苛刻 . 我设法用Spring Session JDBC Build 一个基本环境,并添加了几个 View .

@SpringUI
@SpringViewDisplay
public class MyUI extends UI implements ViewDisplay {

    private Panel springViewDisplay;
    private static final long serialVersionUID = -5326618953003021331L;

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout root = new VerticalLayout();
        root.setSizeFull();
        setContent(root);

        final CssLayout navigationBar = new CssLayout();
        navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
        navigationBar.addComponent(createNavigationButton("Nómina",
            DefaultView.VIEW_NAME));
        navigationBar.addComponent(createNavigationButton("Empleados",
            EmpleadosAdminView.VIEW_NAME));
        root.addComponent(navigationBar);

        springViewDisplay = new Panel();
        springViewDisplay.setSizeFull();
        root.addComponent(springViewDisplay);
        root.setExpandRatio(springViewDisplay, 1.0f);
    }
}

DefaultView 加载正常:

@SpringView(name = DefaultView.VIEW_NAME)
public class DefaultView extends VerticalLayout implements View {

    public static final String VIEW_NAME = "";
    private static final long serialVersionUID = 3600517630040771693L;

    @PostConstruct
    void init() {
        addComponent(new Label("Default view"));
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
    // This view is constructed in the init() method()
    }
}

但是,第二个视图在访问时会抛出以下异常:

@SpringView(name = EmpleadosAdminView.VIEW_NAME)
public class EmpleadosAdminView extends VerticalLayout implements View {

    public static final String VIEW_NAME = "empleados";
    private static final long serialVersionUID = 3344332615518673282L;

    private final EmpleadoRepository empleadoRepository;
    private final EmpleadosEditor empleadosEditor;

    private final Grid<Empleado> grid;

    private final TextField filter;

    private final Button addNewEmpleado;

    @Autowired
    public EmpleadosAdminView(EmpleadoRepository empleadoRepository, EmpleadosEditor empleadosEditor) {
        this.empleadoRepository = empleadoRepository;
        this.empleadosEditor = empleadosEditor;
        this.grid = new Grid<>(Empleado.class);
        this.filter = new TextField();
        this.addNewEmpleado = new Button("Agregar nuevo empleado", VaadinIcons.PLUS);
    }

    private void listEmpleados(String filterText) {
        if (StringUtils.isEmpty(filterText)) {
           grid.setItems(empleadoRepository.findAll());
        } else {
        grid.setItems(empleadoRepository.findByNombreIgnoreCase(filterText));
        }
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
        HorizontalLayout actions = new HorizontalLayout(filter, addNewEmpleado);
        VerticalLayout mainLayout = new VerticalLayout(actions, grid, empleadosEditor);
        addComponent(mainLayout);

        grid.setHeight(300, Unit.PIXELS);
        grid.setColumns("id", "nombre", "cedula");

    filter.setPlaceholder("Filtrar por nombre");

    filter.setValueChangeMode(ValueChangeMode.LAZY);
    filter.addValueChangeListener(e -> listEmpleados(e.getValue()));

    grid.asSingleSelect().addValueChangeListener(e ->
            empleadosEditor.editEmpleado(e.getValue())
    );

    addNewEmpleado.addClickListener(e -> empleadosEditor.editEmpleado(new Empleado()));

    empleadosEditor.setChangeHandler(() -> {
        empleadosEditor.setVisible(false);
        listEmpleados(filter.getValue());
    });

    listEmpleados(null);
}
}

Hibernate:选择empleado0_.id为id1_0_,empleado0_.activo为activo2_0_,empleado0_.cedula为cedula3_0_,empleado0_.nombre为nombre4_0_来自Empleado empleado0_ 2018-03-20 19:07:21.222 WARN 13380 --- [nio-8080- exec-3] com.vaadin.event.ListenerMethod:应用程序序列化出错:类com.tomasa.nomina.ui.EmpleadosEditor $$ Lambda $ 658/1513980400必须实现序列化 . 2018-03-20 19:07:21.230 ERROR 13380 --- [nio-8080-exec-3] com.vaadin.server.DefaultErrorHandler:org.springframework.core.convert.ConversionFailedException:无法从类型[java . lang.Object]为值'com.vaadin.server.VaadinSession@22659fd5'键入[byte []];嵌套异常是org.springframework.core.serializer.support.SerializationFailedException:无法使用DefaultSerializer序列化对象;嵌套异常是java.io.NotSerializableException:org.springframework.dao.support.PersistenceExceptionTranslationInterceptor org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:46)〜[spring-core-5.0.4.RELEASE .jar:5.0.4.RELEASE]在org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:191)〜[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:575)〜[spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.jdbc . JdbcOperationsSessionRepository.access $ 500(JdbcOperationsSessionRepository.java:130)〜[spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.jdbc.JdbcOperationsSessionRepository $ 2.lambda $ doInTransactionWithoutResult $ 2( org.s的JdbcOperationsSessionRepository.java:440)~ [spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] pringframework.jdbc.core.JdbcTemplate.lambda $ update $ 0(JdbcTemplate.java:853)〜[spring-jdbc-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.jdbc.core.JdbcTemplate . 执行(JdbcTemplate.java:605)〜[spring-jdbc-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:850)~ [spring -jdbc-5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:905)〜[spring-jdbc-5.0.4.RELEASE.jar: 5.0.4.RELEASE] org.springframework.session.jdbc.JdbcOperationsSessionRepository $ 2.doInTransactionWithoutResult(JdbcOperationsSessionRepository.java:437)〜[spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org orsp.springframework.transaction.support.TransactionTemplate.execute中的.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:36)〜[spring-tx-5.0.4.RELEASE.jar:5.0.4.RELEASE] TransactionTemplate.java:140)~ [spring-tx-5.0.4.RELEASE.jar: 5.0.4.RELEASE]在org.springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:409)〜[spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org . springframework.session.jdbc.JdbcOperationsSessionRepository.save(JdbcOperationsSessionRepository.java:130)〜[spring-session-jdbc-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:228)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryRequestWrapper.access $ 100 (SessionRepositoryFilter.java:196)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE]在org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryResponseWrapper.onResponseCommitted(SessionRepositoryFilter.java: 184)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.web.http.OnCo在org.springframework.session.web.http.OnCommittedResponseWrapper.checkContentLength(OnCommittedResponseWrapper.java)中的mmittedResponseWrapper.doOnResponseCommitted(OnCommittedResponseWrapper.java:227)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] :217)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.session.web.http.OnCommittedResponseWrapper.trackContentLength(OnCommittedResponseWrapper.java:177)〜[spring- session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.session.web.http.OnCommittedResponseWrapper.access $ 1100(OnCommittedResponseWrapper.java:38)〜[spring-session-core-2.0 . 2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.session.web.http.OnCommittedResponseWrapper $ SaveContextServletOutputStream.write(OnCommittedResponseWrapper.java:613)〜[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.springframework.security.web.util.OnCommittedResponseWrapper $ SaveContextServletOutputStream.write(OnCommittedResponseWrapper.java:633)〜[spring-security -web-5.0.3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.util.OnCommittedResponseWrapper $ SaveContextServletOutputStream.write(OnCommittedResponseWrapper.java:633)〜[spring-security-web-5.0 . 3.RELEASE.jar:5.0.3.RELEASE] com的com.vaadin.server.communication.UIInitHandler.commitJsonResponse(UIInitHandler.java:126)〜[vaadin-server-8.3.1.jar:8.3.1] . vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:109)〜[vaadin-server-8.3.1.jar:8.3.1] at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)〜 [vaadin-server-8.3.1.jar:8.3.1] at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1601)~ [vaadin-server-8.3.1.jar:8.3.1] at com .vaadin.server.VaadinServlet.service(VAA dinServlet.java:445)[vaadin-server-8.3.1.jar:8.3.1] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)[tomcat-embed-core-8.5.28.jar :8.5.28] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.core . ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)[tomcat -embed-websocket-8.5.28.jar:8.5.28] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat-embed-core-8.5.28.jar:8.5.28 ] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain . org.springframework.sec上的doFilter(FilterChainProxy.java:320)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.access上的urity.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] . org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy . )中的intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] . java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)[spring-security] -web-5.0.3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE .jar:5.0.3.RELEASE]在org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE在org.springf orme.springframework.security.web.authentication中的ramework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] . 匿名身份验证过滤.doFilter(AnonymousAuthenticationFilter.java:111)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java: 334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)[spring-security-web -5.0.3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE.jar :5.0.3.RELEASE] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)[spring-security-web-5.0.3.RE LEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3 . 发布org.springframework上的org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] .web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy) .java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)[ spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0 . 3.RELEASE.jar:5.0.3.RELEASE] atorg.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.web.filter . 在Org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)上的OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter [security-security-web-5.0-.RELEASE.jar:5.03.RELEASE] .3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0 .3.RELEASE]在org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)[spring-security-web-5.0.3.RELEASE.jar:5.0.3 . 在org.springframework.security.web.FilterChainProxy上的org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE]发布$ VirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215 )[spring-security-web-5.0.3.RELEASE.jar:5.0.3.RELEASE] org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)[spring-security-web-5.0 . 3.RELEASE.jar:5.0.3.RELEASE]在org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.apringframe.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193)[汤姆cat-embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5 . 28] org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.web.filter.OncePerRequestFilter .doFilter(OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat- embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.j ar:5.0.4.RELEASE]在org.apache.catalina的org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat-embed-core-8.5.28.jar:8.5.28] .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)[在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)的spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] [spring-web-5.0.4.RELEASE.jar: 5.0.4.RELEASE] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat-embed-core-8.5.28.jar:8.5.28] org.apache.catalina.core .ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:146)[ spring 会话核心2.0.2.RELEASE.j ar:2.0.2.RELEASE] at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)[spring-session-core-2.0.2.RELEASE.jar:2.0.2.RELEASE] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain) .java:166)[tomcat-embed-core-8.5.28.jar:8.5.28] org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)[spring-web-5.0.4 . RELEASE.jar:5.0.4.RELEASE] org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org .apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java :166)[tomcat-embed-core-8.5.28.jar:8.5.28]在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)[tomcat-embed-core-8.5.28.jar:8.5 .28] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.catalina.authenticator.AuthenticatorBase . 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)调用(AuthenticatorBase.java:496)[tomcat-embed-core-8.5.28.jar:8.5.28] [tomcat-embed-core -8.5.28.jar:8.5.28] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)[tomcat-embed-core-8.5.28.jar:8.5.28] at org . apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)[tomcat-embed-core-8.5.28.jar:8.5.28]在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 342)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)[tomcat-embed-core-8.5.28.jar :8 .5.28] org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)[tomcat-embed-core-8.5.28.jar:8.5.28] at org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(抽象协议.java:790)[tomcat-embed-core-8.5.28.jar:8.5.28]在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1459)[tomcat-embed -core-8.5.28.jar:8.5.28] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)[tomcat-embed-core-8.5.28.jar:8.5.28 ] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[na:1.8.0_161] at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)[na:1.8.0_161 ] atg.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)[tomcat-embed-core-8.5.28.jar:8.5.28] at java.lang.Thread.run( Thread.java:748)[na:1.8.0_161]

我的代码基于这些教程:

http://vaadin.github.io/spring-tutorial/ https://spring.io/guides/gs/crud-with-vaadin/

不确定我做错了什么,或者是否有一些我需要修改的配置 . 基本认证配置如下:

JDBCHttpSessionConfig.java

@Configuration
@EnableJdbcHttpSession
public class JdbcHttpSessionConfig {
}

SecurityConfig.java

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    private static final Logger LOG = LoggerFactory.getLogger(SecurityConfig.class);

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf().disable() // Use Vaadin's CSRF protection
                .authorizeRequests().anyRequest().authenticated() // User must be authenticated to access any part of the application
                .and()
                .httpBasic();
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers("/css/*"); // Static resources are ignored
    }
}

1 回答

  • 0

    日志中的以下行显示了核心问题:

    2018-03-20 19:07:21.222 WARN 13380 --- [nio-8080-exec-3] com.vaadin.event.ListenerMethod : Error in serialization of the application: Class com.tomasa.nomina.ui.EmpleadosEditor$$Lambda$658/1513980400 must implement serialization.
    

    由于 JdbcOperationsSessionRepository uses standard Java serialization在存储会话时,您必须确保您在会话中放置的属性实现 Serializable . 在您的情况下,类 com.tomasa.nomina.ui.EmpleadosEditor$$Lambda$658/1513980400 看起来像不符合该要求的罪犯 .

    您应该仔细检查您的应用程序,查看最终放置在会话中的所有对象,并让它们实现 Serializable Contract .

相关问题