Standardize Build

Fixes gh-769
This commit is contained in:
Rob Winch
2017-02-03 22:31:18 -06:00
parent e23aaeca5f
commit d590ca58e4
87 changed files with 710 additions and 1257 deletions

View File

@@ -1,48 +0,0 @@
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-snapshot" }
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE'
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}
apply from: JAVA_GRADLE
apply from: TOMCAT_7_GRADLE
apply from: SAMPLE_GRADLE
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'samples'
dependencies {
compile(project(':spring-session-data-redis')) {
exclude module: 'jedis'
}
compile "org.springframework.boot:spring-boot-starter-data-jpa",
"org.springframework.boot:spring-boot-starter-thymeleaf",
"org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-websocket",
"org.springframework:spring-websocket:${springVersion}",
"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect",
"io.lettuce:lettuce-core:$lettuceVersion",
"org.webjars:bootstrap:$bootstrapVersion",
"org.webjars:html5shiv:$html5ShivVersion",
"org.webjars:knockout:2.3.0",
"org.webjars:sockjs-client:0.3.4",
"org.webjars:stomp-websocket:2.3.0",
"org.webjars:webjars-locator",
"com.h2database:h2",
"org.springframework.security:spring-security-web:$springSecurityVersion",
"org.springframework.security:spring-security-config:$springSecurityVersion",
"org.springframework.security:spring-security-messaging:$springSecurityVersion",
"org.springframework.security:spring-security-data:$springSecurityVersion"
testCompile "org.springframework.boot:spring-boot-starter-test",
"org.springframework.security:spring-security-test:$springSecurityVersion"
}

View File

@@ -0,0 +1,30 @@
apply plugin: 'io.spring.convention.spring-sample-boot'
dependencies {
compile(project(':spring-session-data-redis')) {
exclude module: 'jedis'
}
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile"org.springframework.boot:spring-boot-starter-thymeleaf"
compile"org.springframework.boot:spring-boot-starter-web"
compile"org.springframework.boot:spring-boot-starter-websocket"
compile"org.springframework:spring-websocket"
compile"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
compile"io.lettuce:lettuce-core"
compile"org.webjars:bootstrap"
compile"org.webjars:html5shiv"
compile"org.webjars:knockout"
compile"org.webjars:sockjs-client"
compile"org.webjars:stomp-websocket"
compile"org.webjars:webjars-locator"
compile"com.h2database:h2"
compile"org.springframework.security:spring-security-web"
compile"org.springframework.security:spring-security-config"
compile"org.springframework.security:spring-security-messaging"
compile"org.springframework.security:spring-security-data"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "org.springframework.security:spring-security-test"
}

View File

@@ -68,10 +68,6 @@ public class UserRepositoryUserDetailsService implements UserDetailsService {
return AuthorityUtils.createAuthorityList("ROLE_USER");
}
public String getName() {
return getUsername();
}
public String getUsername() {
return getEmail();
}

View File

@@ -16,8 +16,7 @@
package sample.websocket;
import java.util.Collections;
import java.util.Optional;
import java.util.Arrays;
import sample.data.ActiveWebSocketUser;
import sample.data.ActiveWebSocketUserRepository;
@@ -43,11 +42,14 @@ public class WebSocketDisconnectHandler<S>
if (id == null) {
return;
}
Optional<ActiveWebSocketUser> user = this.repository.findOne(id);
if (user.isPresent()) {
this.repository.delete(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Collections.singleton(user.map(ActiveWebSocketUser::getUsername)));
ActiveWebSocketUser user = this.repository.findOne(id);
if (user == null) {
return;
}
this.repository.delete(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Arrays.asList(user.getUsername()));
}
}