File tree 2 files changed +33
-1
lines changed
spring-boot-samples/spring-boot-sample-actuator
src/test/java/sample/actuator
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 24
24
<groupId >org.springframework.boot</groupId >
25
25
<artifactId >spring-boot-starter-web</artifactId >
26
26
</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 >
28
46
<!-- Optional -->
29
47
<dependency >
30
48
<groupId >org.springframework.boot</groupId >
Original file line number Diff line number Diff line change 25
25
import org .springframework .boot .test .context .SpringBootTest ;
26
26
import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
27
27
import org .springframework .boot .test .web .client .TestRestTemplate ;
28
+ import org .springframework .context .annotation .Configuration ;
28
29
import org .springframework .http .HttpStatus ;
29
30
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 ;
30
33
import org .springframework .test .annotation .DirtiesContext ;
31
34
import org .springframework .test .context .junit4 .SpringRunner ;
32
35
39
42
*/
40
43
@ RunWith (SpringRunner .class )
41
44
@ SpringBootTest (classes = {
45
+ ShutdownSampleActuatorApplicationTests .SecurityConfiguration .class ,
42
46
SampleActuatorApplication .class }, webEnvironment = WebEnvironment .RANDOM_PORT )
43
47
public class ShutdownSampleActuatorApplicationTests {
44
48
@@ -73,4 +77,14 @@ private String getPassword() {
73
77
return "password" ;
74
78
}
75
79
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
+
76
90
}
You can’t perform that action at this time.
0 commit comments