January 2018
Intermediate to advanced
414 pages
10h 29m
English
We have created our initialization on an object, but let's create a set of them, as we did in previous chapters:
package com.microservices.chapter5import com.microservices.chapter5.Customer.Telephoneimport org.springframework.beans.factory.annotation.Autowiredimport org.springframework.data.mongodb.core.ReactiveMongoOperationsimport org.springframework.stereotype.Componentimport javax.annotation.PostConstruct@Componentclass DatabaseInitializer { @Autowired lateinit var customerRepository: CustomerRepository @Autowired lateinit var mongoOperations: ReactiveMongoOperations companion object { val initialCustomers = listOf(Customer(1, "Kotlin"), Customer(2, "Spring"), Customer(3, "Microservice", Telephone("+44", ...
Read now
Unlock full access