From ef090079322df1f128013dfd29b78a57162dee1e Mon Sep 17 00:00:00 2001 From: slavisa-baeldung Date: Sun, 6 Nov 2016 22:28:05 +0100 Subject: [PATCH] BAEL-89 - reformatting source - adding packaging to pom to parent spring-session module --- .../session/tomcatex/JettyWebApplication.java | 22 ++++++------- .../session/tomcatex/SecurityConfig.java | 16 +++++----- .../session/tomcatex/SessionConfig.java | 8 ++--- .../src/main/resources/application.properties | 1 - spring-session/pom.xml | 2 ++ .../session/tomcatex/SecurityConfig.java | 32 +++++++++---------- .../tomcatex/TomcatWebApplication.java | 30 ++++++++--------- 7 files changed, 56 insertions(+), 55 deletions(-) diff --git a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/JettyWebApplication.java b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/JettyWebApplication.java index 2cdc5f99af..7bbc776eaa 100644 --- a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/JettyWebApplication.java +++ b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/JettyWebApplication.java @@ -8,17 +8,17 @@ import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController public class JettyWebApplication { - public static void main(String[] args) { - SpringApplication.run(JettyWebApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(JettyWebApplication.class, args); + } - @RequestMapping - public String helloJetty() { - return "hello Jetty"; - } + @RequestMapping + public String helloJetty() { + return "hello Jetty"; + } - @RequestMapping("/test") - public String lksjdf() { - return ""; - } + @RequestMapping("/test") + public String lksjdf() { + return ""; + } } diff --git a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java index 202cad27e6..6ed7df9218 100644 --- a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java +++ b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java @@ -10,12 +10,12 @@ import org.springframework.security.config.http.SessionCreationPolicy; @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .sessionManagement() - .sessionCreationPolicy(SessionCreationPolicy.NEVER) - .and() - .authorizeRequests().anyRequest().hasRole("ADMIN"); - } + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.NEVER) + .and() + .authorizeRequests().anyRequest().hasRole("ADMIN"); + } } diff --git a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SessionConfig.java b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SessionConfig.java index 59fdefe30b..f261f66f9d 100644 --- a/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SessionConfig.java +++ b/spring-session/jetty-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SessionConfig.java @@ -10,8 +10,8 @@ import org.springframework.session.web.http.HttpSessionStrategy; @Configuration @EnableRedisHttpSession public class SessionConfig extends AbstractHttpSessionApplicationInitializer { - @Bean - public HttpSessionStrategy httpSessionStrategy() { - return new HeaderHttpSessionStrategy(); - } + @Bean + public HttpSessionStrategy httpSessionStrategy() { + return new HeaderHttpSessionStrategy(); + } } diff --git a/spring-session/jetty-session-demo/src/main/resources/application.properties b/spring-session/jetty-session-demo/src/main/resources/application.properties index 902de4e45f..7f81672eda 100644 --- a/spring-session/jetty-session-demo/src/main/resources/application.properties +++ b/spring-session/jetty-session-demo/src/main/resources/application.properties @@ -1,4 +1,3 @@ server.port=8081 - spring.redis.host=localhost spring.redis.port=6379 \ No newline at end of file diff --git a/spring-session/pom.xml b/spring-session/pom.xml index 74561edc59..fec6a46af2 100644 --- a/spring-session/pom.xml +++ b/spring-session/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.baeldung parent-modules @@ -12,6 +13,7 @@ spring-session 1.0.0-SNAPSHOT + pom jetty-session-demo diff --git a/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java b/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java index 91cd749c4c..3e419b27a2 100644 --- a/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java +++ b/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/SecurityConfig.java @@ -11,21 +11,21 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { - @Autowired - public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication() - .withUser("user").password("password").roles("USER").and() - .withUser("admin").password("password").roles("ADMIN"); - } + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication() + .withUser("user").password("password").roles("USER").and() + .withUser("admin").password("password").roles("ADMIN"); + } - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .httpBasic().and() - .authorizeRequests() - .antMatchers("/").permitAll() - .antMatchers("/tomcat").hasRole("USER") - .antMatchers("/tomcat/admin").hasRole("ADMIN") - .anyRequest().authenticated(); - } + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .httpBasic().and() + .authorizeRequests() + .antMatchers("/").permitAll() + .antMatchers("/tomcat").hasRole("USER") + .antMatchers("/tomcat/admin").hasRole("ADMIN") + .anyRequest().authenticated(); + } } diff --git a/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/TomcatWebApplication.java b/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/TomcatWebApplication.java index 417aaddf29..58c6b807ec 100644 --- a/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/TomcatWebApplication.java +++ b/spring-session/tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex/TomcatWebApplication.java @@ -8,22 +8,22 @@ import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController public class TomcatWebApplication { - public static void main(String[] args) { - SpringApplication.run(TomcatWebApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(TomcatWebApplication.class, args); + } - @RequestMapping - public String helloDefault() { - return "hello default"; - } + @RequestMapping + public String helloDefault() { + return "hello default"; + } - @RequestMapping("/tomcat") - public String helloTomcat() { - return "hello tomcat"; - } + @RequestMapping("/tomcat") + public String helloTomcat() { + return "hello tomcat"; + } - @RequestMapping("/tomcat/admin") - public String helloTomcatAdmin() { - return "hello tomcat admin"; - } + @RequestMapping("/tomcat/admin") + public String helloTomcatAdmin() { + return "hello tomcat admin"; + } }