Skip to content

Akorsa/spring-blog

Repository files navigation

spring-data

This project demonstrates Spring Data, Spring Web MVC, Spring Security and Thymeleaf. It accompanies blog posts at http://akorsa.ru which are listed below in their accompanying implementation version.

##Implemented##

Implementations listed below by version are found in their corresponding branch, v0.0.1, v0.0.2, etc. Recent branches may not contain features found in prior versions.

##v0.2.1 -- Spring MVC and JavaScript Samplings##

  • Bootstrap Dialog Box with requirement to be logged-in to view
  • JQuery Bootstrap Multiselect Plugin with Spring MVC JSON-populated Options and postback
  • SpringLoaded to Hot Reload Java Class updates w/o app restart

##v0.2.0 -- Spring Data JPA Auditing##

  • Spring data JPA Auditing

##v0.1.9 -- More Child Object Handling in MVC and Thymeleaf

Radio Button Child Hobby Objects in v0.1.9

##v0.1.8 -- Child Object Processing, MVC Method Level Security##

##v0.1.7 -- Full MySQL Support, WAR Deployment##

##v0.1.6 -- Initial Release w/ Spring Security##

Registration form validation in v0.1.6

##v0.1.5 -- Contact Add/Update Form, Dandelion Asset Bundling##

##v0.1.4 -- Contact Display, List and Search##

Bootstrap with All Contacts Display in Spring-Data MVC with Thymeleaf v0.1.4

##v0.1.3 -- Initial release w/ Thymeleaf##

Spring-Data MVC with Thymeleaf in v0.1.3

##v0.1.2 -- Multi-Module with JPA and MVC Modules##

Spring-Data Does MVC in v0.1.2

##v0.1.1 -- @ManyToMany Hobbies added to Contact Model##

  • Addition of Hobbies, a @ManyToMany Entity with Contacts
  • Adding Hobbies dynamically on new and updated Contacts, and as separate process
  • Adding and removing Hobbies from Contact
  • ContactDTO with Set
  • Tests covering above Hobby processes
  • Post: Working with the Many in a JPA @ManyToMany

##v0.1.0 -- @OneToMany Contact Phones added to Contact Model##

##v0.0.9 -- Lazy Loading examples##

  • Several examples of Lazy Loading. See NixMash post Approaches to JPA Lazy Loading for details
  • First pass at creating schema DTO objects for use in updating and creating data
  • Modified database schema to better adhere to database relationship best practices. Updates are reflected in Entities.

##v0.0.8 -- Multi-database configuration w/ H2Console and MySQL##

  • h2database and mySQL JPA Data Configuration
  • Profiles based on Enumerator value (ex: JpaDataConfig.MYSQL)

##v0.0.7 -- Multi-profile configuration##

  • ApplicationContext and Data Retrieval Tests
  • "Production" and "Dev" Spring Profiles
  • Re-architected main() to load context, and a single bean to startup application
  • Broke out Production and Dev Profile Configurations, extend base SpringConfiguration class. Plan to redesign further
  • Spring Profile set in Gradle.build bootRun task

##v0.0.6 -- GUI Generated Entities and Diagram Examples##

  • Generated supplemental Contact, ContactTelDetail and Hobby Entities using the IntelliJ Persistence View GUI tools. (Contain "Entity" classname suffix.)
  • Output based on new Entities, shown below
  • Updated to Spring 4.1.6, Spring-Boot 1.2.3

Image of Spring Data JPA Output v0.0.6

##v0.0.5 -- Hibernate and JPA Module structure##

  • Broke-up the application into two separate IntelliJ Modules
  • Root and child Gradle project configuration

##v0.0.4 -- Initial Release with JPA##

  • Spring Data JPA Implementation
  • Dual SpringJPAConfiguration and SpringHbnConfiguration classes
  • Simultaneous use of both Spring Data JPA and Hibernate with Transaction Isolation
  • Updated MySQL Schema with additional data
  • Shared Model Entities between Hibernate and Spring Data JPA
  • Spring 4.0.6, Spring-Boot 1.1.4

Image of Spring Data JPA Output v0.0.4

##v0.0.3 -- DAO Implementation##

  • Generic DAO Interface Implementation
  • Added Service Facade
  • Persistence Tier broken out to Domain Model, Data Access Object and Service Layers
  • Data and Output identical to v0.0.1
  • Spring 4.0.6, Spring-Boot 1.1.4

##v0.0.2 -- Using Spring Properties##

  • Populating DataSource connection from Property File
  • Using both @Value and @Autowired Environment properties
  • Annotations with @ImportResource of app-context.xml file
  • Custom SpringPropertiesUtil Class to retrieve overriden "username" System Property
  • Populating @Autowired PropertyClass class properties in @Configuration class and retrieving the properties in another class
  • Spring 4.0.6, Spring-Boot 1.1.4

Image of Output v0.0.2

##v0.0.1 -- Base Configuration in Spring and Hibernate##

  • Changed XML Spring Configuration to Annotations
  • Changed datasource from embedded H2 to MySql
  • Lazy Fetching
  • Named Queries
  • Logging Configuration
  • Gradle Build Configuration
  • Inserting data
  • Note: v0.0.1 was created with Spring Boot v1.1.4. Using v1.2.x generates a compile error regarding JPA Entity handling.

Image of Output v0.0.1

##Installation##

The application supports an H2 Profile (default) and a MySQL Profile. To run JPA Console app use $gradle jpa:bootRun. To run MVC Web app use $gradle mvc:bootRun. The Tomcat Server Port is set for 8084 (set in the MVC application.properties file) so go to http://localhost:8084 to view the app in your browser.

##Database Configuration##

To use MySQL run setup.mysql script in the /doc/install directory to populate the database. Update Datasource connection properties in /resources/META-INF/spring/mysql.properties file. The H2 create-data script for the tests is located in /resources/db.

##References##

Version 0.0.1 of the app was based on Chapter #7 of Pro Spring, Fourth Edition from Apress, "Using Hibernate." (An excellent book, btw.) Here is the book's listing on Apress. For Safari users, here is the online version of it on Safari.

The Generic DAO structure in Version 0.0.3 was based on Chapter #2 of Spring in Practice by Willie Wheeler and Joshua White, "Data persistence, ORM, and transactions." Here is the Chapter on Safari.

Multiple database JPA Configuration implemented in Version 0.0.8 based largely on the work of Gordon Dickens' Spring-Data- Demos "Profiles" project.

Several components related to Thymeleaf and Security in Version 0.1.x from Arnaldo Piccnelli's [Enhanced Pet Clinic.] (https://github.com/arnaldop/enhanced-pet-clinic)

Petri Kainulainen’s excellent book Spring Data from Packt Publishing and accompanying source code was a reference for Model Attribute handling and feedback messaging in Version 0.1.5 as well as other features.

Two excellent source references for Spring Security which initially appeared in Version 0.1.6 were Rob Winch's gs-spring- security-3.2 something and Bartosz Kielczewski's [example-spring-boot-security] (https://github.com/bkielczewski/example-spring-boot-security).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors