Skip to content

Commit 12cb478

Browse files
committed
Restore files changes by accident
1 parent 1d8e4a8 commit 12cb478

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

spring-boot-samples/spring-boot-sample-actuator/pom.xml

+19-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,25 @@
2424
<groupId>org.springframework.boot</groupId>
2525
<artifactId>spring-boot-starter-web</artifactId>
2626
</dependency>
27-
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-security</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-jdbc</artifactId>
34+
</dependency>
35+
<!-- Runtime -->
36+
<dependency>
37+
<groupId>org.apache.httpcomponents</groupId>
38+
<artifactId>httpclient</artifactId>
39+
<scope>runtime</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>com.h2database</groupId>
43+
<artifactId>h2</artifactId>
44+
<scope>runtime</scope>
45+
</dependency>
2846
<!-- Optional -->
2947
<dependency>
3048
<groupId>org.springframework.boot</groupId>

spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java

+14
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
import org.springframework.boot.test.context.SpringBootTest;
2626
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
2727
import org.springframework.boot.test.web.client.TestRestTemplate;
28+
import org.springframework.context.annotation.Configuration;
2829
import org.springframework.http.HttpStatus;
2930
import org.springframework.http.ResponseEntity;
31+
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
32+
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
3033
import org.springframework.test.annotation.DirtiesContext;
3134
import org.springframework.test.context.junit4.SpringRunner;
3235

@@ -39,6 +42,7 @@
3942
*/
4043
@RunWith(SpringRunner.class)
4144
@SpringBootTest(classes = {
45+
ShutdownSampleActuatorApplicationTests.SecurityConfiguration.class,
4246
SampleActuatorApplication.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
4347
public class ShutdownSampleActuatorApplicationTests {
4448

@@ -73,4 +77,14 @@ private String getPassword() {
7377
return "password";
7478
}
7579

80+
@Configuration
81+
static class SecurityConfiguration extends WebSecurityConfigurerAdapter {
82+
83+
@Override
84+
protected void configure(HttpSecurity http) throws Exception {
85+
http.csrf().disable();
86+
}
87+
88+
}
89+
7690
}

0 commit comments

Comments
 (0)