Tutorial by Examples

package com.mcf7.spring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringDataMicroServiceApplication { public static void main(String[] args) { SpringApplication....
package com.mcf7.spring.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable;...
package com.mcf7.spring.domain; import org.springframework.data.repository.PagingAndSortingRepository; public interface BookRepository extends PagingAndSortingRepository<Book, Long> { } Basic Spring Repository pattern, except we enabled a Paging and Sorting Repository for extra featu...
package com.mcf7.spring.domain; import org.springframework.validation.Errors; import org.springframework.validation.Validator; public class BeforeCreateBookValidator implements Validator{ public boolean supports(Class<?> clazz) { return Book.class.equals(clazz); } ...
package com.mcf7.spring.domain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class DatabaseLoader implements CommandLineRunner { private final BookRep...
package com.mcf7.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.rest.core.event.ValidatingRepositoryEventListener; import org...
buildscript { repositories { jcenter() } dependencies { classpath 'io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE' } } apply plugin: 'io.spring.dependency-management' apply plugin: 'idea' apply plugin: 'java' dependencyManagement { imp...

Page 1 of 1