Skip to content

Commit

Permalink
Migration to Spring Boot 3 && Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
mouradski committed Oct 18, 2023
1 parent e0687da commit db36bd4
Show file tree
Hide file tree
Showing 15 changed files with 276 additions and 250 deletions.
291 changes: 147 additions & 144 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,153 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>dev.mouradski</groupId>
<artifactId>sgb-nft-market-bot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bot</name>
<description>Sgb NFT Sales Bot</description>
<properties>

</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>com.github.ipfs</groupId>
<artifactId>java-ipfs-http-client</artifactId>
<version>v1.3.3</version>
</dependency>


<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.8.7</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>

<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.8.0</version>
<type>pom</type>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<build>

<finalName>bot</finalName>

<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>dev.mouradski</groupId>
<artifactId>sgb-nft-market-bot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bot</name>
<description>Sgb NFT Sales Bot</description>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>com.github.ipfs</groupId>
<artifactId>java-ipfs-http-client</artifactId>
<version>v1.3.3</version>
</dependency>


<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.10.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>

<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.8.0</version>
<type>pom</type>
</dependency>
</dependencies>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<build>

<finalName>bot</finalName>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<finalName>bot</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>dev.mouradski.sgbnftbot.SgbNftSalesBotApplication</mainClass>
</manifest>
</archive>
<source>17</source>
<target>17</target>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>bot</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>dev.mouradski.sgbnftbot.SgbNftSalesBotApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
25 changes: 11 additions & 14 deletions src/main/java/dev/mouradski/sgbnftbot/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
@Configuration
public class Config {

@Value("${discord.token}")
private String discordToken;

@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();

MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
var restTemplate = new RestTemplate();

var converter = new MappingJackson2HttpMessageConverter();

converter.setSupportedMediaTypes(
Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));
Expand All @@ -39,29 +35,30 @@ public RestTemplate restTemplate() {

@Bean("songbirdWeb3")
public Web3j songbirdWeb3(@Value("${web3.songbird.provider}") String songbirdRpcProviderUrl) {
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
OkHttpClient client = httpClient.build();
var httpClient = new OkHttpClient.Builder();
var client = httpClient.build();

HttpService httpService = new HttpService(songbirdRpcProviderUrl, client);
var httpService = new HttpService(songbirdRpcProviderUrl, client);

return Web3j.build(httpService);
}


@Bean("flareWeb3")
public Web3j flaredWeb3(@Value("${web3.flare.provider}") String flareRpcProviderUrl) {
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
OkHttpClient client = httpClient.build();
var httpClient = new OkHttpClient.Builder();
var client = httpClient.build();

HttpService httpService = new HttpService(flareRpcProviderUrl, client);
var httpService = new HttpService(flareRpcProviderUrl, client);

return Web3j.build(httpService);
}

@Bean
@ConditionalOnProperty(value = "app.production")
public DiscordApi discordApi() {
return new DiscordApiBuilder().setToken(discordToken).setAllNonPrivilegedIntents()
public DiscordApi discordApi(@Value("${discord.token}") String discordToken) {
return new DiscordApiBuilder().setToken(discordToken)
.setAllIntents()
.login().join();
}
}
5 changes: 1 addition & 4 deletions src/main/java/dev/mouradski/sgbnftbot/model/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter

public class Attribute {
@JsonProperty("trait_type")
private String traitType;
Expand Down
Loading

0 comments on commit db36bd4

Please sign in to comment.