Merge pull request #4457 from eugenp/BAEL-1661_v2

formatting
This commit is contained in:
Loredana Crusoveanu 2018-06-14 13:31:48 +03:00 committed by GitHub
commit 0105456ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 67 deletions

View File

@ -16,14 +16,14 @@ public class Config implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
registry.addViewController("/")
.setViewName("index");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
@Bean
public ITemplateResolver templateResolver() {
ClassLoaderTemplateResolver resolver
= new ClassLoaderTemplateResolver();
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setPrefix("templates/books/");
resolver.setSuffix(".html");
resolver.setTemplateMode(TemplateMode.HTML);

View File

@ -16,7 +16,7 @@ public class InMemoryBookService implements BookService {
@Override
public List<Book> findAll() {
return new ArrayList(booksDB.values());
return new ArrayList<>(booksDB.values());
}
@Override
@ -29,14 +29,14 @@ public class InMemoryBookService implements BookService {
}
Map<Long, Book> bookMap = books.stream()
.collect(Collectors.toMap(
Book::getId, Function.identity()));
.collect(Collectors.toMap(Book::getId, Function.identity()));
booksDB.putAll(bookMap);
}
private Long getNextId(){
return booksDB.keySet().stream()
private Long getNextId() {
return booksDB.keySet()
.stream()
.mapToLong(value -> value)
.max()
.orElse(0) + 1;

View File

@ -5,9 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
@SpringBootApplication(
exclude = {SecurityAutoConfiguration.class,
DataSourceAutoConfiguration.class})
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class, DataSourceAutoConfiguration.class })
public class ListBindingApplication {
public static void main(String[] args) {

View File

@ -41,7 +41,9 @@ public class MultipleBooksController {
@GetMapping(value = "/edit")
public String showEditForm(Model model) {
List<Book> books = new ArrayList<>();
bookService.findAll().iterator().forEachRemaining(books::add);
bookService.findAll()
.iterator()
.forEachRemaining(books::add);
model.addAttribute("form", new BooksCreationDto(books));