Spring4
In
TNG-CMS
Spring4 in TNG-CMS
• Spring Boot
• Spring Data JPA
• Spring Data REST
• Spring security
• Spring MVC
• …
Spring Boot
Spring Boot
• just run “java –jar …”
• embedded servers
• Jar or War
• Databases
• H2database(memdb)
• Hibernate 
• Spring Data JPA
• Spring ORMs
• No XML
• Java configure
• Annotation
• Autoconfig
• Hot swapping
• Reload static content(html, css, javascript)
• Reload templates (Thymeleaf , FreeMarker, Velocity)
• Reload Java classes(spring bean)
Spring Boot
• externalized configuration
• command line properties (--server.port=9000)
• Application property files (/config)
• yml
• Dependencies management (spring-boot-dependencies)
• Logging
• Security
• Messaging(JMS)
• Mail(javaMail)
• Transaction
• Actuator
• Metrics
• health checks
Spring Boot - Actuator
ID Description Sensitive
autoconfig Displays an auto-configuration report showing all auto-
configuration candidates and the reason why they ‘were’ or ‘were
not’ applied.
true
beans Displays a complete list of all the Spring beans in your application. true
configprops Displays a collated list of all @ConfigurationProperties. true
dump Performs a thread dump. true
env Exposes properties from Spring’s ConfigurableEnvironment. true
health Shows application health information (a simple ‘status’ when
accessed over an unauthenticated connection or full message
details when authenticated).
false
info Displays arbitrary application info. false
metrics Shows ‘metrics’ information for the current application. true
mappings Displays a collated list of all @RequestMapping paths. true
shutdown Allows the application to be gracefully shutdown (not enabled by
default).
true
trace Displays trace information (by default the last few HTTP
requests).
true
Spring Data JPA
Spring Data JPA
• CRUD Repository
• @NoRepositoryBean
• Query methods
• Property expressions
• (List<Person> findByAddressZipCode(ZipCode zipCode);)
• Paging And Sorting
• Limiting query results
• Auditing
• Annotation based auditing metadata
• @CreatedBy, @LastModifiedBy, @CreatedDate and @LastModifiedDate
• Interface-based auditing metadata
Spring Data REST
Spring Data REST
• REST web services
• GET/POST/PUT/DELETE
• hypermedia driven way
• Paging and Sorting
• http://localhost:8080/persons?page=1&size=5
• http://localhost:8080/people/search/nameStartsWith?name=K&sort=name,desc
• Projections and Excerpts
• Hiding repository CRUD methods
• @RestResource(exported = false)
Spring Security
Spring Security
• Authentication
• User/authority
• User/group/authority
• ACL
• Authorization
• Form Login
• Authorize Requests
• Method Security
• ACL
• HTTP/HTTPS
Spring Security
• JDBC Authentication
• JdbcDaoImpl
• Security Database Schema
• Remember-Me Authentication
• Password Encoder
• Cross Site Request Forgery (CSRF)
• Spring security with AngularJS
• Ip White list
• spring-security-taglibs
• Thymeleaf
• thymeleaf-extras-springsecurity4
Appendix
• Gradle
Why gradle
Gradle combines the best features from other build tools
Why gradle
Comparing build script size and readability between Maven and
Gradle
Why gradle
Gradle's Compelling Feature Set
Why gradle
• Expressive Build Language and Deep API
Build scripts apply the
Gradle DSL and have
access to its deep API.
Why gradle
• Flexible Conventions
In Gradle, Java projects are build by convention with sensible
defaults. Changing the defaults is easy and achieved through
convention properties.
Why gradle
• Integration with Other Build Tools
Gradle provides deep integration with other build tools and
opens the door to gradually migrate your existing Ant or Maven
build.
Why gradle
• Automating Your Project from Build to Deployment
Stages of a deployment pipeline.
Tasks performed in stages of build pipeline
Q&A
Many Thanks!

Spring4 in tng cms

  • 1.
  • 3.
    Spring4 in TNG-CMS •Spring Boot • Spring Data JPA • Spring Data REST • Spring security • Spring MVC • …
  • 4.
  • 5.
    Spring Boot • justrun “java –jar …” • embedded servers • Jar or War • Databases • H2database(memdb) • Hibernate  • Spring Data JPA • Spring ORMs • No XML • Java configure • Annotation • Autoconfig • Hot swapping • Reload static content(html, css, javascript) • Reload templates (Thymeleaf , FreeMarker, Velocity) • Reload Java classes(spring bean)
  • 6.
    Spring Boot • externalizedconfiguration • command line properties (--server.port=9000) • Application property files (/config) • yml • Dependencies management (spring-boot-dependencies) • Logging • Security • Messaging(JMS) • Mail(javaMail) • Transaction • Actuator • Metrics • health checks
  • 7.
    Spring Boot -Actuator ID Description Sensitive autoconfig Displays an auto-configuration report showing all auto- configuration candidates and the reason why they ‘were’ or ‘were not’ applied. true beans Displays a complete list of all the Spring beans in your application. true configprops Displays a collated list of all @ConfigurationProperties. true dump Performs a thread dump. true env Exposes properties from Spring’s ConfigurableEnvironment. true health Shows application health information (a simple ‘status’ when accessed over an unauthenticated connection or full message details when authenticated). false info Displays arbitrary application info. false metrics Shows ‘metrics’ information for the current application. true mappings Displays a collated list of all @RequestMapping paths. true shutdown Allows the application to be gracefully shutdown (not enabled by default). true trace Displays trace information (by default the last few HTTP requests). true
  • 8.
  • 9.
    Spring Data JPA •CRUD Repository • @NoRepositoryBean • Query methods • Property expressions • (List<Person> findByAddressZipCode(ZipCode zipCode);) • Paging And Sorting • Limiting query results • Auditing • Annotation based auditing metadata • @CreatedBy, @LastModifiedBy, @CreatedDate and @LastModifiedDate • Interface-based auditing metadata
  • 10.
  • 11.
    Spring Data REST •REST web services • GET/POST/PUT/DELETE • hypermedia driven way • Paging and Sorting • http://localhost:8080/persons?page=1&size=5 • http://localhost:8080/people/search/nameStartsWith?name=K&sort=name,desc • Projections and Excerpts • Hiding repository CRUD methods • @RestResource(exported = false)
  • 12.
  • 13.
    Spring Security • Authentication •User/authority • User/group/authority • ACL • Authorization • Form Login • Authorize Requests • Method Security • ACL • HTTP/HTTPS
  • 14.
    Spring Security • JDBCAuthentication • JdbcDaoImpl • Security Database Schema • Remember-Me Authentication • Password Encoder • Cross Site Request Forgery (CSRF) • Spring security with AngularJS • Ip White list • spring-security-taglibs • Thymeleaf • thymeleaf-extras-springsecurity4
  • 15.
  • 16.
    Why gradle Gradle combinesthe best features from other build tools
  • 17.
    Why gradle Comparing buildscript size and readability between Maven and Gradle
  • 18.
  • 19.
    Why gradle • ExpressiveBuild Language and Deep API Build scripts apply the Gradle DSL and have access to its deep API.
  • 20.
    Why gradle • FlexibleConventions In Gradle, Java projects are build by convention with sensible defaults. Changing the defaults is easy and achieved through convention properties.
  • 21.
    Why gradle • Integrationwith Other Build Tools Gradle provides deep integration with other build tools and opens the door to gradually migrate your existing Ant or Maven build.
  • 22.
    Why gradle • AutomatingYour Project from Build to Deployment Stages of a deployment pipeline. Tasks performed in stages of build pipeline
  • 23.
  • 24.