BAEL-3900 Fixed ApplicationLiveTest.

This commit is contained in:
Mathieu Fortin 2020-03-02 15:02:08 -05:00
parent e8da9d39f7
commit 77be697980
3 changed files with 18 additions and 1 deletions

View File

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

View File

@ -2,12 +2,25 @@ package org.baeldung.custom.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; 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.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration @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 @Bean
public PasswordEncoder encoder() { public PasswordEncoder encoder() {
return new BCryptPasswordEncoder(11); return new BCryptPasswordEncoder(11);

View File

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