This file contains hidden or 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
| package com.example; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.test.web.servlet.MockMvc; | |
| import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |
| import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | |
| import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
This file contains hidden or 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
| package com.example; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.ResponseBody; | |
| @Controller | |
| public class SalarioMinimoController { | |
| @GetMapping("/salarios") |
This file contains hidden or 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
| package com.example; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.test.web.servlet.MockMvc; | |
| import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |
| import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | |
| import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
This file contains hidden or 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
| package com.example; | |
| import org.springframework.stereotype.Controller; | |
| @Controller | |
| public class SalarioMinimoController { | |
| } |
This file contains hidden or 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
| import org.junit.Before; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.test.web.servlet.MockMvc; | |
| import org.springframework.test.web.servlet.setup.MockMvcBuilders; | |
| public class SalarioMinimoControllerTest extends DemoApplicationTests { | |
| private MockMvc mockMvc; | |
This file contains hidden or 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
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.springframework.boot.test.context.SpringBootTest; | |
| import org.springframework.test.context.TestPropertySource; | |
| import org.springframework.test.context.junit4.SpringRunner; | |
| import br.com.paydomestic.DemoApplication; | |
| @RunWith(SpringRunner.class) | |
| @SpringBootTest(classes = DemoApplication.class) |
This file contains hidden or 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
| # DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) | |
| spring.datasource.url=jdbc:mysql://localhost/meubanco_test | |
| spring.datasource.username=root | |
| spring.datasource.password=root | |
| spring.datasource.tomcat.test-on-borrow=true | |
| spring.datasource.tomcat.validation-query=SELECT 1 | |
| spring.datasource.sql-script-encoding=UTF-8 | |
| # JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration) | |
| spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.ImprovedNamingStrategy |
This file contains hidden or 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
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-test</artifactId> | |
| <scope>test</scope> | |
| </dependency> |
This file contains hidden or 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
| package com.baeldung.spring.security.x509; | |
| import java.security.Principal; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.security.access.prepost.PreAuthorize; | |
| import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | |
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
This file contains hidden or 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
| class Api::V1::UserController < ApplicationController | |
| def index | |
| @api_v1_users = User.all | |
| render json: @api_v1_users | |
| end | |
| end | |
| ### |