https://docs.spring.io/spring-framework/docs/5.3.7/reference/html/core.html#beans-java-scoped-proxy has 2 examples of use of @SessionScope: kotlin and java.

The kotlin version is missing a )

Even the java version looks incorrect:

// an HTTP Session-scoped bean exposed as a proxy
@Bean
@SessionScope
public UserPreferences userPreferences() {
    return new UserPreferences();
}

@Bean
public Service userService() {
    UserService service = new SimpleUserService();
    // a reference to the proxied userPreferences bean
    service.setUserPreferences(userPreferences());
    return service;
}

Why is the implementation of userService invoking the userPreferences method directly? Shouldn't it be like this?:

// an HTTP Session-scoped bean exposed as a proxy
@Bean
@SessionScope
public UserPreferences userPreferences() {
    return new UserPreferences();
}

@Bean
public Service userService(UserPreferences injectedUserPreferences) {
    UserService service = new SimpleUserService();
    // a reference to the proxied userPreferences bean
    service.setUserPreferences(injectedUserPreferences);
    return service;
}

Comment From: jbotuck

OK I reviewed https://docs.spring.io/spring-framework/docs/5.3.7/reference/html/core.html#beans-java-configuration-annotation and realize that I am apparently very wrong about my complaints with the java version

The kotlin version still looks like it's missing a )