when i used @SpringUI but I want to use SessionScope ,

when i used @SpringUI with default @UIScope but I want to use @SessionScope , how can I change the scope?

If you want session scoped content in your UI, it is preferred that you inject there it as session scoped beans, but you should not (and probably cannot change scope of the UI).

thanks,I also have a questions about UI.getCurrent()= null ,this is a static method ,why I use this in a class it throws nullPoint Exception

UI.getCurrent() is not thread safe, hence it is returning null when called outside main thread.

For example in Views you should implement your View by extending some component, usually Layout and use components getUI() method to get and store the UI reference for further use. In other use cases get and store the UI reference in class constructor. In both cases use ui with try - catch, since UIDetached exception may occur, if user has closed the Browser.

https://stackoverflow.com/questions/51137436/how-to-get-access-ui-thread-from-child-thread-in-vaadin-8/51142018#51142018