• Stars
    star
    245
  • Rank 165,304 (Top 4 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NixMash Spring : JPA, Social, MVC, Solr, Security, Thymeleaf...

NixMash Spring

NixMash Spring is a Web Bootstrap 3 application demonstrating Spring, Java and supporting web technologies including:

       
Spring Boot Spring Data JPA Spring Solr Spring Web MVC
Spring Security Spring Social Hibernate Mockito
Json Gradle Spring Mail Jsoup
Multi-Profile Configurations JPA Auditing Webjars Dandelion
Velocity Templating (pre v.0.4.1) @PreAuthorize Method Security REST Templates RSS View Resolver
Custom Validators @Controller Advice Custom Exception Handling Tagging with Typeahead
JPA @NamedQueries and @NamedNativeQueries JPA Paging and Sorting Bootstrap3 Responsive Admin Dashboard
RSS w/ AbstractRSSView Thymeleaf Like Buttons File Uploading
MultiFile Upload w/Blueimp JPA @SqlResultSetMapping and @ConstructorResult Spring Gradle Dependency Plugin FreeMarker Templating (v0.4.0+)
Spring Caching Spring Batch AuthenticationFailure Handling

Please Note: NixMash Blog Is the New NixMash Spring

NixMash Spring has become NixMash Blog Engine and is online at NixMash.com. The GitHub Repository is located here. There is also a WordPress to NixMash Blog Migrator for migrating WordPress blogs to the NixMash Blog Engine. That repository is found here.

Learning Spring Boot

The primary purpose for this app is to help fellow developers learn Spring Boot. Each feature in NixMash Spring has one or more companion blog posts at NixMash.com where we go deep on the Cool Tech of the Day. See the list of blog posts on the Release Changelist below.

See the Installation section below on how to configure NixMash Spring to get up and running. Once configured you can build the project in Gradle with a bash script:

project_root>$ install/sh/buildAll.sh

All modules should compile and tests succeed, at which point you can launch the web app with

$ gradle mvc:bootRun

The application has five supporting modules, JPA, Mail, Solr, Batch and Jsoup, each of which can also be executed with $ gradle [module]:bootRun.

Home Page in  Release 0.3.1

Implemented

Implementations listed in the Release History below are found in their corresponding branch, v0.0.1, v0.0.2, etc. Newer branches may not contain features found in prior versions.

Release History

v0.5.0 -- Spring Batch Functions, User Registration Updates

[back to top]

v0.4.5 -- CKEditor and Post Editing Updates

  • Replaced Summernote Editor with CKEditor
  • Full support for Code Highlighting
  • Fix for Exceptions logged on Administrative Post Edit and Post Update pages
  • Cache update modifications to "posts" caches by postId and postName. All Post properties updated on Post Update.

[back to top]

v0.4.4 -- Spring Caching

[back to top]

v0.4.3 -- Post Searching with Solr

v0.4.3 Post Full Search form

[back to top]

v0.4.2 -- Post "Save and Continue" and Post Preview, Post Status and Password Administration Improvements

v0.4.2 Post Save and Continue

[back to top]

v0.4.1 -- Move from Velocity to FreeMarker for support templates

[back to top]

v0.4.0 -- Spring Boot 1.4.0 and Dependency Upgrades

[back to top]

v0.3.6 -- Post Add/Edit Moved to Administration

v0.3.6 Administration Posts List

[back to top]

v0.3.5 -- Posts A-Z, MultiPhoto posts, Flashcard Q&A, User Profile updates

[back to top]

v0.3.4 -- Post tag cloud, sharing, likes, RSS, title display

v0.3.4 Liked Posts

[back to top]

v0.3.3 -- Post WYSIWYG editing, tagging, permalinks

v0.3.3 Post Update Form

[back to top]

v0.3.2 -- Initial Posts Feature Release

v0.3.2 Posts Stream

[back to top]

v0.3.1 -- SiteOptions Properties, GitHub Buttons, Google Analytics

v0.3.1 GitHub Buttons

[back to top]

v0.3.0 -- Spring Boot 1.3.4, NavBar Submenus

  • Bootstrap3 NavBar Submenus
  • Upgrade to Spring Boot 1.3.4, primarily to re-activate DevTools which had a bug in 1.3.3 stopping MySql services on app shutdown

[back to top]

v0.2.9 -- Site Administration Start, Profile Image Uploads, Email Services

v0.2.9 Administration

[back to top]

v0.2.8 -- Spring Social

v0.2.8 Social Sign-In Buttons

[back to top]

v0.2.7 -- Solr MVC

Solr Search in v0.2.7

[back to top]

v0.2.6 -- Solr Query Samplings

Solr Facet Query in v0.2.6

[back to top]

v0.2.5 -- Spring Boot 1.3

  • Spring-Boot-1.3.0.RELEASE

[back to top]

v0.2.4 -- Multiple Solr Repository Configurations

Four Solr Repository Options in v0.2.4

[back to top]

v0.2.3 -- Initial Solr Release

Simple Solr Query results in v0.2.3

[back to top]

v0.2.2 -- Eclipse-Friendly NixMash Spring

NixMash Spring in Eclipse Project Explorer for v0.2.2

[back to top]

v0.2.1 -- Spring MVC and JavaScript Samplings

Bootstrap Multiselect Plugin in v0.2.1

[back to top]

v0.2.0 -- Spring Data JPA Auditing

MySQL JPA Audit Data in v0.2.0

[back to top]

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

Radio Button Child Hobby Objects in v0.1.9

[back to top]

v0.1.8 -- Child Object Processing (Phones), MVC Method Level Security

Contact Phone Children in v0.1.8

[back to top]

v0.1.7 -- Full MySQL Support, WAR Deployment

[back to top]

v0.1.6 -- Initial Release w/ Spring Security

Registration form validation in v0.1.6

[back to top]

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

Using jQuery-UI with Dandelion in v0.1.5

[back to top]

v0.1.4 -- Contact Display, List and Search

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

[back to top]

v0.1.3 -- Initial release w/ Thymeleaf

Spring-Data MVC with Thymeleaf in v0.1.3

[back to top]

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

Spring-Data Does MVC in v0.1.2

[back to top]

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

[back to top]

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

[back to top]

v0.0.9 -- Lazy Loading examples

  • Several examples of Lazy Loading
  • 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.
  • Post: Approaches to JPA Lazy Loading

[back to top]

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

[back to top]

v0.0.7 -- Multi-profile configuration

[back to top]

v0.0.6 -- GUI Generated Entities and Diagram Examples

Image of Spring Data JPA Output v0.0.6

[back to top]

v0.0.5 -- Hibernate and JPA Module structure

[back to top]

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
  • Post: JPA Added to Spring Data GitHub App v0.0.4

Image of Spring Data JPA Output v0.0.4

[back to top]

v0.0.3 -- DAO Implementation

[back to top]

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
  • Post: A Spring Property Handling Exercise
  • Post: Spring-Data Demo App v0.0.2 on GitHub

Image of Output v0.0.2

[back to top]

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.
  • Post: New Spring-Data Demo on GitHub

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 9000 (set in the MVC application.properties file) so go to http://localhost:9000 to view the app in your browser.

Installation - Database Configuration

To use MySQL run mysqlsetup.sql script in the /install/sql 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.

Installation - External Property Files

The JPA, Mail, Solr and Batch Modules use external Property Files which must be configured to compile successfully. To Configure the location of the Properties Files, change the @PropertySource annotation setting in Jpa/ApplicationSettings.class and Mail/MailSettings.java. You can quickly locate these settings by searching "/home/daveburke" in your IDE.

@Component
@PropertySource("file:/home/daveburke/web/nixmashspring/external.properties")
@ConfigurationProperties(prefix="external")
public class ApplicationSettings {

An example of *.properties files used by the modules are found in the /install/samples folder. Update the property values for your environment.

Installation - Solr

Configure Solr as normally on your development machine. Documents are included in /install/solr/docs and scripts to populate the Solr Url and Embedded Servers located in /install/solr. Script name: refreshSolr.sh. It contains additional installation instructions.

The Solr Project demonstrates both Embedded Solr and Http Solr ("dev" and "prod" Profiles respectively.) Configure these in an external solr.properties file. Same configuration as external.properties and mail.properties files discussed above. Set solr.properties file location in Solr project common/SolrSettings.java @PropertySource value.

You can start by chosing not to include Solr in your application. To do so, remove solr from the root Gradle settings.gradle file and from MVC Module's build.gradle (compile project(':solr')). While in that build.gradle file you will notice a line to uncomment if you are not using Solr. That is to use Tomcat as your embedded Web Server. Otherwise the app will use the Jetty embedded server as part of the Solr-Core package dependency.

Installation - File Uploads

You will need to create a physical /files storage area to upload Profile Images. On a WAR deployment (like at http://nixmashspring.daveburkevt.com) you could use Apache2 mod_proxy to support those physical locations. For development at http://localhost:9000 you could create a soft-link to the /files location. See the NixMash.com post Profile Image Uploads: On Image File Storage for details on creating a soft-link. See Deploying Your Spring Boot WAR Application on adding a /files alias in Apache2. There are also bash scripts in /install/sh for creating a build/files soft-link and all site support directories.

Installation - Gradle BuildAll Script

When you've added your external.properties files, configured MySQL and, optionally, Solr, there is a bash script found in /install/sh named buildAll.sh which will build each module and run all tests (which should pass), at which point you can run the app in IntelliJ/Eclipse or at the command line:

$ gradle mvc:bootRun

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.

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.

Petri Kainulainen also served as a great reference on Solr in Version 0.2.3. See his excellent Spring Data Solr Tutorial(http://www.petrikainulainen.net/spring-data-solr-tutorial/) on his blog. Another good reference on Solr was Christoph Strobl's spring-data-solr-examples on GitHub.

Spring Framework contributor Christoph Strobl's Spring Data Solr Showcase(https://github.com/christophstrobl/spring-data-solr-showcase) served as the basis of Solr Autocomplete found in Version 0.2.7.

The Social Showcase for Spring Boot Sample Project was helpful in becoming oriented with Spring Social in Version 0.2.8. Petri Kainulainen remains my Go-To Spring Guru, here for Spring Social in his 4-Part Tutorial.

The Administrative Dashboard introduced in Version 0.2.9 is based on the Gentelella Bootstrap Dashboard on GitHub.