Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
[tuub#84] Servlet support for Fileserver and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Richter committed Jun 14, 2018
1 parent a1225da commit f3254df
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,28 @@ public class FileserverApplication extends SpringBootServletInitializer {
/**
* Starts the fileserver application when deployed as war in a separate servlet container.
*
* @param application the application
* @param builder the application builder
* @return a builder
*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application
.sources(FileserverApplication.class)
.properties(
"spring.config.name:"
+ "default,"
+ "local,"
+ "application");
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return configureApplication(builder);
}

/**
* Starts the fileserver appplication when deployed with spring boot.
*
* @param args external arguments
* Everything starts here.
* @param args program arguments
*/
public static void main(String[] args) {
configureApplication(new SpringApplicationBuilder()).run(args);
}

new SpringApplicationBuilder(FileserverApplication.class)
.properties(
"spring.config.name:"
+ "default,"
+ "local,"
+ "application")
.build().run(args);
private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
return builder
.sources(FileserverApplication.class)
.properties("spring.config.name:"
+ "default,"
+ "local,"
+ "application");
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

server:
port: 8980

spring:
jmx:
# this gives Hikari Datasource an unique name, so Fileserver and UI may run parallel in Tomcat
default-domain: datasource-fileserver
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,39 @@

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
* UI application starter.
*/
@SpringBootApplication
public class UiApplication {
public class UiApplication extends SpringBootServletInitializer {

/**
* Starts the UI application when deployed as war in a separate servlet container.
*
* @param builder the application builder
* @return a builder
*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return configureApplication(builder);
}

/**
* Everything starts here.
* @param args program arguments
*/
public static void main(String[] args) {
configureApplication(new SpringApplicationBuilder()).run(args);
}

new SpringApplicationBuilder(UiApplication.class)
.properties(
"spring.config.name:"
+ "default,"
+ "local,"
+ "application")
.build().run(args);
private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
return builder
.sources(UiApplication.class)
.properties("spring.config.name:"
+ "default,"
+ "local,"
+ "application");
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.springframework.context.annotation.Import;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.LocaleResolver;
Expand Down Expand Up @@ -136,15 +134,6 @@ public Validator getValidator() {
return validator;
}

/**
* Gets the password encoder to be used.
* @return PasswordEncoder
*/
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}

/**
* The media server utilities.
* @return the bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

Expand Down Expand Up @@ -69,4 +71,13 @@ public void globalSecurityConfiguration(AuthenticationManagerBuilder auth) throw
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder);
}

/**
* Gets the password encoder to be used.
* @return PasswordEncoder
*/
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
server:
port: 8981

spring:
jmx:
# this gives Hikari Datasource an unique name, so Fileserver and UI may run parallel in Tomcat
default-domain: datasource-ui

0 comments on commit f3254df

Please sign in to comment.