Upgrade samples to Boot 2.0.0.M1

Fixes gh-782
This commit is contained in:
Vedran Pavic
2017-05-24 23:18:30 +02:00
parent 22f4b0bc9d
commit 79f187ddd6
26 changed files with 37 additions and 330 deletions

View File

@@ -18,10 +18,10 @@ package sample.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {

View File

@@ -18,7 +18,6 @@ package sample.websocket;
import java.util.Arrays;
import sample.data.ActiveWebSocketUser;
import sample.data.ActiveWebSocketUserRepository;
import org.springframework.context.ApplicationListener;
@@ -42,14 +41,10 @@ public class WebSocketDisconnectHandler<S>
if (id == null) {
return;
}
ActiveWebSocketUser user = this.repository.findOne(id);
if (user == null) {
return;
}
this.repository.delete(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Arrays.asList(user.getUsername()));
this.repository.findById(id).ifPresent(user -> {
this.repository.deleteById(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Arrays.asList(user.getUsername()));
});
}
}