Skip to content

Commit

Permalink
try aot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Jul 4, 2024
1 parent 5d8d33b commit 5832fb9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ COPY test-account-activation.html /config/mail/account-activation.html
COPY test-password-reset.html /config/mail/password-reset.html
COPY test-welcome-to-faf.html /config/mail/welcome-to-faf.html
ENV FAF_DOMAIN=faforever.com
ENV CHALLONGE_KEY=test
RUN java -Djarmode=tools -jar application.jar extract
RUN java -Dspring.context.exit=onRefresh -Dspring.profiles.active=training -XX:ArchiveClassesAtExit=application.jsa -jar application/application.jar

Expand Down
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {
plugins {
id "java"
id "org.springframework.boot" version "3.3.1"
id "org.springframework.boot.aot" version "3.3.1"
id "idea"
id "com.adarshr.test-logger" version "4.0.0"
}
Expand All @@ -31,7 +32,10 @@ repositories {
maven { url "https://jitpack.io" }
}

compileJava.dependsOn(processResources)
compileJava {
dependsOn(processResources)
options.compilerArgs.add("-parameters")
}

configurations {
compile.exclude module: "assertj-core"
Expand Down Expand Up @@ -126,6 +130,11 @@ test {
}
}

processAot {
environment("FAF_DOMAIN", "faforever.com")
environment("API_PROFILE", "")
}

ext {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import com.faforever.api.config.FafApiProperties;
import com.faforever.api.config.FafApiProperties.Challonge;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
Expand All @@ -22,7 +21,6 @@
import org.springframework.web.util.DefaultUriBuilderFactory;
import org.springframework.web.util.UriBuilder;

import jakarta.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

Expand All @@ -37,7 +35,6 @@
* only loaded if a Challonge API key is specified.</p>
*/
@RestController
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
@RequestMapping(path = ChallongeController.CHALLONGE_ROUTE)
@ConditionalOnProperty("faf-api.challonge.key")
public class ChallongeController {
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/com/faforever/api/config/LocalizationConfig.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
package com.faforever.api.config;

import com.faforever.api.i18n.RepositoryMessageSource;
import org.springframework.context.HierarchicalMessageSource;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.MessageSourceAccessor;

import jakarta.inject.Inject;

@Configuration
public class LocalizationConfig {

@Bean
public MessageSourceAccessor messageSourceAccessor(MessageSource messageSource) {
public MessageSourceAccessor messageSourceAccessor(RepositoryMessageSource messageSource) {
return new MessageSourceAccessor(messageSource);
}

@Inject
public void configureMessageSource(HierarchicalMessageSource messageSource, RepositoryMessageSource repositoryMessageSource) {
messageSource.setParentMessageSource(repositoryMessageSource);
}
}
5 changes: 3 additions & 2 deletions src/main/java/com/faforever/api/config/elide/ElideConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.yahoo.elide.jsonapi.JsonApiSettings;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -35,8 +36,8 @@ public class ElideConfig {

@Bean
MultiplexManager multiplexDataStore(
DataStore fafDataStore,
DataStore leagueDataStore
@Qualifier("fafDataStore") DataStore fafDataStore,
@Qualifier("leagueDataStore")DataStore leagueDataStore
) {
return new MultiplexManager(fafDataStore, leagueDataStore);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/config/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:127.0.0.1}
port: ${RABBIT_PORT:5672}
username: ${RABBIT_USERNAME:faf-java-api}
username: ${RABBIT_USERNAME:faf-api}
password: ${RABBIT_PASSWORD:banana}
virtual-host: ${RABBIT_VHOST:/faf-core}
jpa:
Expand All @@ -80,8 +80,8 @@ spring:
oauth2:
resourceserver:
jwt:
jwk-set-uri: https://hydra.faforever.com/.well-known/jwks.json
issuer-uri: https://hydra.faforever.com/
jwk-set-uri: http://localhost:4444/.well-known/jwks.json
issuer-uri: http://ory-hydra:4444/
logging:
level:
com.faforever.api: debug
com.faforever.api: debug
2 changes: 2 additions & 0 deletions src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ spring:
resourceserver:
jwt:
issuer-uri: ${JWT_FAF_HYDRA_ISSUER:https://hydra.${FAF_DOMAIN}/}
aot:
enabled: true

server:
# Mind that this is configured in the docker compose file as well (that is, in the gradle script that generates it)
Expand Down

0 comments on commit 5832fb9

Please sign in to comment.