Merge pull request #8810 from mathieufortin01/BAEL-3900

BAEL-3900 Fixed ApplicationLiveTest.
This commit is contained in:
Jonathan Cook 2020-03-04 22:18:15 +01:00 committed by GitHub
commit f2d45b8269
5 changed files with 23 additions and 2 deletions

View File

@ -3,9 +3,11 @@ package org.baeldung.custom;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@ComponentScan("org.baeldung.custom")
@PropertySource("classpath:application-defaults.properties")
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@ -2,11 +2,27 @@ package org.baeldung.custom.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
public class SecurityConfig {
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.csrf()
.disable()
.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.formLogin()
.permitAll();
}
@Bean
public PasswordEncoder encoder() {

View File

@ -3,9 +3,11 @@ package org.baeldung.ip;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@ComponentScan("org.baeldung.ip")
@PropertySource("classpath:application-defaults.properties")
public class IpApplication extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@ -13,7 +13,7 @@ import io.restassured.specification.RequestSpecification;
import org.junit.Test;
import org.springframework.http.MediaType;
// In order to execute these tests, org.baeldung.custom.Application needs to be running.
public class ApplicationLiveTest {
@Test

View File

@ -8,6 +8,7 @@ import io.restassured.response.Response;
import org.junit.Test;
// In order to execute these tests, org.baeldung.ip.IpApplication needs to be running.
public class IpLiveTest {
@Test