☕ Cap 09: Stack Corporativa: Spring Boot 3, Spring Security, JPA/PostgreSQL e Angular Standalone - Exemplos Práticos
Código executável completo demonstrando a integração de sistemas Full Stack.
🗺️ Fluxo de Integração
flowchart LR
ANGULAR["🅰️ Angular Standalone (Signals + NgRx SignalStore)"]
ANGULAR -->|REST JSON + JWT Bearer| SPRING["🍃 Spring Boot 3 (Controllers, Services, Repositories)"]
SPRING --> JPA["Spring Data JPA / Hibernate"]
JPA --> DB["PostgreSQL Database"]
style ANGULAR fill:#ede7f6,stroke:#673ab7,stroke-width:2px
style SPRING fill:#e8f5e9,stroke:#4caf50,stroke-width:2px
style DB fill:#e1f5fe,stroke:#03a9f4,stroke-width:1px
📄 Código de Demonstração (SecurityConfig.java)
// SecurityConfig.java (Spring Boot 3)
package com.empresa.portal.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.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
.csrf(csrf -> csrf.disable())
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers("/api/auth/**", "/swagger-ui/**").permitAll()
.requestMatchers("/api/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
)
.build();
}
}
🚀 Saída Esperada de Execução
2026-08-25T03:55:00.210Z INFO [portal-service] Initializing Spring Security FilterChain
2026-08-25T03:55:00.250Z INFO [portal-service] Stateless session policy configured.
2026-08-25T03:55:00.300Z INFO [portal-service] TomCat started on port 8080 (http) with context path ''
🧭 Navegação Rápida
| 📖 Teoria | 📊 Slides | 🧠 Quiz | 💻 Exemplos | 🧩 Exercícios | | :— | :— | :— | :— | :— | | Ler Tópico | Ver Slides | Fazer Quiz | Ver Código | Praticar |