Skip to content

Commit bec77d6

Browse files
author
eugenp
committed
minor formatting work
1 parent e8bfbd7 commit bec77d6

File tree

9 files changed

+8
-39
lines changed

9 files changed

+8
-39
lines changed

spring-security-rest-full/src/main/java/org/baeldung/persistence/service/impl/FooService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@Service
1818
@Transactional
19-
public class FooService extends AbstractService<Foo>implements IFooService {
19+
public class FooService extends AbstractService<Foo> implements IFooService {
2020

2121
@Autowired
2222
private IFooDao dao;

spring-security-rest-full/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public ActuatorMetricService() {
2727
statusList = new ArrayList<String>();
2828
}
2929

30-
3130
@Override
3231
public Object[][] getGraphData() {
3332
final Date current = new Date();

spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import javax.validation.constraints.Size;
66

7-
87
public class Foo implements Serializable {
98

109
private long id;

spring-security-rest/src/main/java/org/baeldung/spring/SwaggerConfig.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,13 @@
1919
public class SwaggerConfig {
2020

2121
@Bean
22-
public Docket api(){
23-
return new Docket(DocumentationType.SWAGGER_2)
24-
.select()
25-
.apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller"))
26-
.paths(PathSelectors.ant("/foos/*"))
27-
.build()
28-
.apiInfo(apiInfo())
29-
.useDefaultResponseMessages(false)
30-
.globalResponseMessage(RequestMethod.GET,
31-
newArrayList(new ResponseMessageBuilder()
32-
.code(500)
33-
.message("500 message")
34-
.responseModel(new ModelRef("Error"))
35-
.build(),
36-
new ResponseMessageBuilder()
37-
.code(403)
38-
.message("Forbidden!!!!!")
39-
.build()));
22+
public Docket api() {
23+
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")).paths(PathSelectors.ant("/foos/*")).build().apiInfo(apiInfo()).useDefaultResponseMessages(false)
24+
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build(), new ResponseMessageBuilder().code(403).message("Forbidden!!!!!").build()));
4025
}
4126

4227
private ApiInfo apiInfo() {
43-
ApiInfo apiInfo = new ApiInfo(
44-
"My REST API",
45-
"Some custom description of API.",
46-
"API TOS",
47-
"Terms of service",
48-
49-
"License of API",
50-
"API license URL");
28+
ApiInfo apiInfo = new ApiInfo("My REST API", "Some custom description of API.", "API TOS", "Terms of service", "[email protected]", "License of API", "API license URL");
5129
return apiInfo;
5230
}
5331
}

spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ public WebConfig() {
2121

2222
@Override
2323
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
24-
registry.addResourceHandler("swagger-ui.html")
25-
.addResourceLocations("classpath:/META-INF/resources/");
24+
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
2625

27-
registry.addResourceHandler("/webjars/**")
28-
.addResourceLocations("classpath:/META-INF/resources/webjars/");
26+
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
2927
}
3028

3129
@Bean

spring-security-rest/src/main/java/org/baeldung/web/ApiError.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public String getMessage() {
4848
public void setMessage(final String message) {
4949
this.message = message;
5050
}
51+
5152
public List<String> getErrors() {
5253
return errors;
5354
}

spring-security-rest/src/main/java/org/baeldung/web/CustomRestExceptionHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public ResponseEntity<Object> handleMethodArgumentTypeMismatch(final MethodArgum
100100
return new ResponseEntity<Object>(apiError, new HttpHeaders(), apiError.getStatus());
101101
}
102102

103-
104103
@ExceptionHandler({ ConstraintViolationException.class })
105104
public ResponseEntity<Object> handleConstraintViolation(final ConstraintViolationException ex, final WebRequest request) {
106105
logger.info(ex.getClass().getName());
@@ -156,7 +155,6 @@ protected ResponseEntity<Object> handleHttpMediaTypeNotSupported(final HttpMedia
156155
return new ResponseEntity<Object>(apiError, new HttpHeaders(), apiError.getStatus());
157156
}
158157

159-
160158
// 500
161159

162160
@ExceptionHandler({ Exception.class })
@@ -169,4 +167,3 @@ public ResponseEntity<Object> handleAll(final Exception ex, final WebRequest req
169167
}
170168

171169
}
172-

spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public void whenMethodArgumentMismatch_thenBadRequest() {
3434
assertTrue(error.getErrors().get(0).contains("should be of type"));
3535
}
3636

37-
38-
3937
@Test
4038
public void whenNoHandlerForHttpRequest_thenNotFound() {
4139
final Response response = givenAuth().delete(URL_PREFIX + "/api/xx");

spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
@ComponentScan({ "org.baeldung.web" })
88
public class TestConfig {
99

10-
1110
}

0 commit comments

Comments
 (0)