Skip to content

Commit a3775b7

Browse files
committed
Code style
1 parent 2d4d705 commit a3775b7

File tree

1 file changed

+3
-9
lines changed
  • access-control-spring-security/src/main/java/de/dominikschadow/javasecurity/services

1 file changed

+3
-9
lines changed

access-control-spring-security/src/main/java/de/dominikschadow/javasecurity/services/ContactService.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public class ContactService {
4343
@PostAuthorize("returnObject.username == principal.username")
4444
public Contact getContact(int contactId) {
4545
return jdbcTemplate.queryForObject("SELECT * FROM contacts WHERE contact_id = ?",
46-
new Object[]{contactId},
47-
(rs, rowNum) -> {
48-
return createContact(rs);
49-
});
46+
new Object[]{contactId}, (rs, rowNum) -> createContact(rs));
5047
}
5148

5249
/**
@@ -60,13 +57,10 @@ public Contact getContact(int contactId) {
6057
@PreAuthorize("hasRole('ROLE_USER')")
6158
@PostFilter("filterObject.username == principal.username")
6259
public List<Contact> getContacts() {
63-
return jdbcTemplate.query("SELECT * FROM contacts",
64-
(rs, rowNum) -> {
65-
return createContact(rs);
66-
});
60+
return jdbcTemplate.query("SELECT * FROM contacts", (rs, rowNum) -> createContact(rs));
6761
}
6862

69-
private Contact createContact(ResultSet rs) throws SQLException {
63+
private static Contact createContact(ResultSet rs) throws SQLException {
7064
Contact contact = new Contact();
7165
contact.setContactId(rs.getInt("contact_id"));
7266
contact.setUsername(rs.getString("username"));

0 commit comments

Comments
 (0)