package nl.orangeflamingo;

import nl.orangeflamingo.domain.Song;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Application {

    private static final Logger log = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

    @Bean
    public CommandLineRunner demo(SongRepository repository) {
        return (args) -> {
            // fetch all customers
            log.info("Songs found with findAll():");
            log.info("-------------------------------");
            for (Song song : repository.findAll()) {
                log.info(song.toString());
            }
            log.info("");

            // fetch an individual customer by ID
            Song customer = repository.findById(1L).get();
            log.info("Customer found with findOne(1L):");
            log.info("--------------------------------");
            log.info(customer.toString());
            log.info("");

            // fetch customers by artist
            log.info("Customer found with findByLastName('Nirvana'):");
            log.info("--------------------------------------------");
            for (Song song : repository.findByArtist("Nirvana")) {
                log.info(song.toString());
            }
            log.info("");
        };
    }

//    @Bean
//    public CommandLineRunner demo(CustomerRepository repository) {
//        return (args) -> {
//            // fetch all customers
//            log.info("Customers found with findAll():");
//            log.info("-------------------------------");
//            for (Customer customer : repository.findAll()) {
//                log.info(customer.toString());
//            }
//            log.info("");
//
//            // fetch an individual customer by ID
//            Customer customer = repository.findById(1L).get();
//            log.info("Customer found with findOne(1L):");
//            log.info("--------------------------------");
//            log.info(customer.toString());
//            log.info("");
//
//            // fetch customers by last name
//            log.info("Customer found with findByLastName('Bauer'):");
//            log.info("--------------------------------------------");
//            for (Customer bauer : repository.findByLastName("Bauer")) {
//                log.info(bauer.toString());
//            }
//            log.info("");
//        };
//    }

}
@@ -1025,24 +1025,20 @@
    Song 
-customer
+song
  = repos
@@ -1056,20 +1056,72 @@
 yId(1L).
-get(
+orElseThrow(() -%3E new RuntimeException(%22Song not found%22)
 );%0A     
@@ -1248,32 +1248,28 @@
    log.info(
-customer
+song
 .toString())
@@ -1494,36 +1494,39 @@
       for (Song 
-song
+nirvana
  : repository.fi
@@ -1579,1117 +1579,15 @@
 nfo(
-song.toString());%0A            %7D%0A            log.info(%22%22);%0A        %7D;%0A    %7D%0A%0A//    @Bean%0A//    public CommandLineRunner demo(CustomerRepository repository) %7B%0A//        return (args) -%3E %7B%0A//            // fetch all customers%0A//            log.info(%22Customers found with findAll():%22);%0A//            log.info(%22-------------------------------%22);%0A//            for (Customer customer : repository.findAll()) %7B%0A//                log.info(customer.toString());%0A//            %7D%0A//            log.info(%22%22);%0A//%0A//            // fetch an individual customer by ID%0A//            Customer customer = repository.findById(1L).get();%0A//            log.info(%22Customer found with findOne(1L):%22);%0A//            log.info(%22--------------------------------%22);%0A//            log.info(customer.toString());%0A//            log.info(%22%22);%0A//%0A//            // fetch customers by last name%0A//            log.info(%22Customer found with findByLastName('Bauer'):%22);%0A//            log.info(%22--------------------------------------------%22);%0A//            for (Customer bauer : repository.findByLastName(%22Bauer%22)) %7B%0A//                log.info(bauer
+nirvana
 .toS
@@ -1596,18 +1596,16 @@
 ing());%0A
-//
         
@@ -1610,18 +1610,16 @@
       %7D%0A
-//
         
@@ -1636,18 +1636,16 @@
 fo(%22%22);%0A
-//
         
@@ -1651,14 +1651,11 @@
  %7D;%0A
-//
     %7D%0A
-%0A
 %7D

Remove commented code