diff --git a/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java b/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java index 3ce19913..cbd149c5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java @@ -23,11 +23,9 @@ import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; @@ -56,7 +54,6 @@ import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; @GuiProfile @RestController @Order(6) -@Import(DataSourceAutoConfiguration.class) public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements ErrorController { @Value("${sebserver.webservice.api.redirect.unauthorized}") diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebServiceInit.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebServiceInit.java index 3af04b58..9977d26d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebServiceInit.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebServiceInit.java @@ -8,14 +8,25 @@ package ch.ethz.seb.sebserver.webservice; +import javax.sql.DataSource; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Lazy; +import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +@Configuration @WebServiceProfile +@Import(DataSourceAutoConfiguration.class) public class WebServiceInit implements ApplicationListener { private static final Logger log = LoggerFactory.getLogger(WebServiceInit.class); @@ -27,4 +38,10 @@ public class WebServiceInit implements ApplicationListener