Vaadin + Spring Errors

I’m trying to move my UI to using more injected dependencies with Spring, which I already use for my services layer and below. I would get these services injected, via the UI class, using the method:

return (SomeService) SpringContextHelper.getInstance().getBean("someService"); However, after a massive refactor effort, I’ve run into an issue with the startup of my application.

When Jetty starts to load the application, I receive the following errors:

Failed startup of context…nested exception is An Authentication object was not found in the SecurityContext

The dependency it is trying to fill has a service interface that uses @Preauthorize on its methods to perform role-based security. For a simple example:

public interface SomeService { @PreAuthorize("hasAnyAuthority('USER_ROLE)") void doSomething(); } I think it makes sense that the SecurityContext is empty at this stage since we haven’t launched the application yet for a user to be able to login but I don’t know how to correct this. Help is greatly appreciated.