-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cambios para poder trabajar con JSPs
- Loading branch information
Showing
5 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/tecnificados/boot/WebSecurityConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* | ||
*/ | ||
package org.tecnificados.boot; | ||
|
||
|
||
|
||
|
||
|
||
|
||
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.core.userdetails.User; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.core.userdetails.UserDetailsService; | ||
import org.springframework.security.provisioning.InMemoryUserDetailsManager; | ||
|
||
|
||
/** | ||
* @author Juan Carlos Ballesteros (tecnificados.com) | ||
* | ||
*/ | ||
|
||
@Configuration | ||
@EnableWebSecurity | ||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
http | ||
.authorizeRequests() | ||
.antMatchers("/", "/login").permitAll() | ||
.anyRequest().authenticated() | ||
.and() | ||
.formLogin() | ||
.loginPage("/login") | ||
.permitAll() | ||
.and() | ||
.logout() | ||
.permitAll(); | ||
} | ||
|
||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/tecnificados/boot/controller/StartController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* | ||
*/ | ||
package org.tecnificados.boot.controller; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
/** | ||
* @author Juan Carlos Ballesteros (tecnificados.com) | ||
* | ||
*/ | ||
@Controller | ||
public class StartController { | ||
|
||
@RequestMapping("/") | ||
public String mensaje() { | ||
|
||
return "index"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
logging.level.root=info | ||
|
||
spring.mvc.view.prefix=/WEB-INF/views/ | ||
spring.mvc.view.suffix=.jsp | ||
|
||
|
||
|
||
#Configuración de Base de Datos | ||
|
||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
|
||
#Url donde esta el servicio de tu mysql y el nombre de la base de datos | ||
spring.datasource.url=jdbc:mysql://localhost:3306/boot_demo?useSSL=false&serverTimezone=Europe/Madrid | ||
|
||
#Usuario y contrasena para tu base de datos descrita en la línea anterior | ||
spring.datasource.username=boot_demo | ||
spring.datasource.password=boot_demo | ||
|
||
#[opcional]Imprime en tu consola todo el SQL. | ||
spring.jpa.show-sql = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" | ||
pageEncoding="utf-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Hola</title> | ||
</head> | ||
<body> | ||
Hola con Spring Boot | ||
</body> | ||
</html> |