Upgrade Spring

This commit is contained in:
Sebastien 2020-04-12 13:44:08 +02:00
parent 66ffea6a8a
commit 5e1feded79
11 changed files with 26 additions and 26 deletions

View File

@ -1,18 +1,9 @@
buildscript { plugins {
repositories { id 'org.springframework.boot' version '2.2.4.RELEASE'
mavenCentral() id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'groovy'
} }
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
classpath 'org.springframework:springloaded:1.2.6.RELEASE'
}
}
apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
def versionObj = new Version(major: 0, minor: 2, revision: 0) def versionObj = new Version(major: 0, minor: 2, revision: 0)
@ -31,7 +22,7 @@ jar.doFirst {
} }
jar { jar {
delete "${buildDir}/libs/*" // delete "${buildDir}/libs/*"
baseName = 'DiscordBot' baseName = 'DiscordBot'
} }
@ -54,6 +45,9 @@ dependencies {
} }
compile("org.springframework.boot:spring-boot-starter-undertow") compile("org.springframework.boot:spring-boot-starter-undertow")
compile("org.springframework.boot:spring-boot-starter-log4j2") compile("org.springframework.boot:spring-boot-starter-log4j2")
implementation 'org.codehaus.groovy:groovy-all:2.4.15'
compile("com.sedmelluq:lavaplayer:1.3.34") compile("com.sedmelluq:lavaplayer:1.3.34")

View File

@ -1,6 +1,6 @@
#Wed Jan 10 09:57:49 CET 2018 #Sat Feb 15 20:48:19 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip zipStoreBase=GRADLE_USER_HOME

View File

@ -12,4 +12,6 @@ public interface PendingUserRepository extends CrudRepository<PendingUserEntity,
List<PendingUserEntity> findByJdaId(String jdaId); List<PendingUserEntity> findByJdaId(String jdaId);
PendingUserEntity findById(int id);
} }

View File

@ -4,4 +4,5 @@ import net.Broken.DB.Entity.PlaylistEntity;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
public interface PlaylistRepository extends CrudRepository<PlaylistEntity, Integer> { public interface PlaylistRepository extends CrudRepository<PlaylistEntity, Integer> {
PlaylistEntity findById(int id);
} }

View File

@ -8,4 +8,6 @@ import java.util.List;
public interface TrackRepository extends CrudRepository<TrackEntity, Integer> { public interface TrackRepository extends CrudRepository<TrackEntity, Integer> {
List<TrackEntity> findDistinctByPlaylistOrderByPos(PlaylistEntity playlistEntity); List<TrackEntity> findDistinctByPlaylistOrderByPos(PlaylistEntity playlistEntity);
TrackEntity findById(int id);
} }

View File

@ -10,4 +10,5 @@ public interface UserStatsRepository extends CrudRepository<UserStats, Long> {
List<UserStats> findByUser(UserEntity userEntity); List<UserStats> findByUser(UserEntity userEntity);
List<UserStats> findByGuildId(String guildId); List<UserStats> findByGuildId(String guildId);
List<UserStats> findByUserAndGuildId(UserEntity user, String guildId); List<UserStats> findByUserAndGuildId(UserEntity user, String guildId);
} }

View File

@ -95,7 +95,7 @@ public class UserStatsUtils {
} }
} }
stats = (List<UserStats>) userStatsRepository.save(stats); stats = (List<UserStats>) userStatsRepository.saveAll(stats);
userEntity.setUserStats(stats); userEntity.setUserStats(stats);
userEntity = userRepository.save(userEntity); userEntity = userRepository.save(userEntity);

View File

@ -126,7 +126,7 @@ public class UserUtils {
* @throws UserNotFoundException User not found in Pending user DB * @throws UserNotFoundException User not found in Pending user DB
*/ */
public PendingUserEntity confirmCheckToken(PendingUserRepository pendingUserRepository, int id, String checkToken ) throws TokenNotMatch, UserNotFoundException { public PendingUserEntity confirmCheckToken(PendingUserRepository pendingUserRepository, int id, String checkToken ) throws TokenNotMatch, UserNotFoundException {
PendingUserEntity pendingUser = pendingUserRepository.findOne(id); PendingUserEntity pendingUser = pendingUserRepository.findById(id);
if(pendingUser != null) { if(pendingUser != null) {
if(pendingUser.getCheckToken().equals(checkToken)){ if(pendingUser.getCheckToken().equals(checkToken)){
logger.info("Check Token match!"); logger.info("Check Token match!");

View File

@ -100,7 +100,7 @@ public class PlaylistManager {
TrackEntity toDelete = trackRepository.findOne(data.id); TrackEntity toDelete = trackRepository.findById(data.id);
playlist = remove(playlist, toDelete); playlist = remove(playlist, toDelete);
@ -129,7 +129,7 @@ public class PlaylistManager {
TrackEntity toMove = trackRepository.findOne(data.id); TrackEntity toMove = trackRepository.findById(data.id);
TrackEntity save = new TrackEntity(toMove); TrackEntity save = new TrackEntity(toMove);
@ -159,7 +159,7 @@ public class PlaylistManager {
} }
private PlaylistEntity getPlaylist(int id) throws PlaylistNotFoundException{ private PlaylistEntity getPlaylist(int id) throws PlaylistNotFoundException{
PlaylistEntity playlist = playlistRepository.findOne(id); PlaylistEntity playlist = playlistRepository.findById(id);
if(playlist == null) if(playlist == null)
throw new PlaylistNotFoundException(); throw new PlaylistNotFoundException();
else else

View File

@ -3,7 +3,7 @@ package net.Broken.webView;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.resource.ContentVersionStrategy; import org.springframework.web.servlet.resource.ContentVersionStrategy;
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
import org.springframework.web.servlet.resource.VersionResourceResolver; import org.springframework.web.servlet.resource.VersionResourceResolver;
@ -12,7 +12,7 @@ import org.springframework.web.servlet.resource.VersionResourceResolver;
* Configuration for js auto versioning * Configuration for js auto versioning
*/ */
@Configuration @Configuration
public class MvcApplication extends WebMvcConfigurerAdapter { public class MvcApplication implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {

View File

@ -2,7 +2,7 @@ package net.Broken.webView;
import net.Broken.MainBot; import net.Broken.MainBot;
import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Guild;
import org.springframework.boot.autoconfigure.web.ErrorController; import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;