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,19 +1,10 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
classpath 'org.springframework:springloaded:1.2.6.RELEASE'
}
plugins {
id 'org.springframework.boot' version '2.2.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'groovy'
}
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)
@ -31,7 +22,7 @@ jar.doFirst {
}
jar {
delete "${buildDir}/libs/*"
// delete "${buildDir}/libs/*"
baseName = 'DiscordBot'
}
@ -54,6 +45,9 @@ dependencies {
}
compile("org.springframework.boot:spring-boot-starter-undertow")
compile("org.springframework.boot:spring-boot-starter-log4j2")
implementation 'org.codehaus.groovy:groovy-all:2.4.15'
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
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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);
PendingUserEntity findById(int id);
}

View File

@ -4,4 +4,5 @@ import net.Broken.DB.Entity.PlaylistEntity;
import org.springframework.data.repository.CrudRepository;
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> {
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> findByGuildId(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 = userRepository.save(userEntity);

View File

@ -126,7 +126,7 @@ public class UserUtils {
* @throws UserNotFoundException User not found in Pending user DB
*/
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.getCheckToken().equals(checkToken)){
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);
@ -129,7 +129,7 @@ public class PlaylistManager {
TrackEntity toMove = trackRepository.findOne(data.id);
TrackEntity toMove = trackRepository.findById(data.id);
TrackEntity save = new TrackEntity(toMove);
@ -159,7 +159,7 @@ public class PlaylistManager {
}
private PlaylistEntity getPlaylist(int id) throws PlaylistNotFoundException{
PlaylistEntity playlist = playlistRepository.findOne(id);
PlaylistEntity playlist = playlistRepository.findById(id);
if(playlist == null)
throw new PlaylistNotFoundException();
else

View File

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

View File

@ -2,7 +2,7 @@ package net.Broken.webView;
import net.Broken.MainBot;
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.stereotype.Controller;
import org.springframework.ui.Model;