bael-4828: add main source to new maven module

This commit is contained in:
hmdrzsharifi 2021-04-02 12:09:36 +04:30
parent 49769beacf
commit 7f249e4133
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package com.baeldung.tls;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HomeController {
@GetMapping("/baeldung")
public ResponseEntity<String> welcome() {
return new ResponseEntity<>("tls/baeldung", HttpStatus.OK);
}
}

View File

@ -0,0 +1,16 @@
package com.baeldung.tls;
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;
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/**")
.permitAll();
}
}

View File

@ -0,0 +1,15 @@
package com.baeldung.tls;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
public class TLSEnabledApplication {
public static void main(String... args) {
SpringApplication application = new SpringApplication(TLSEnabledApplication.class);
application.setAdditionalProfiles("tls");
application.run(args);
}
}