The study project Sagan that Spring official net recommends

Spring fastens frame to be like Spring, springboot, the Springcloud bid that already made Java development matchs, the author also is the old user that Spring is frame, they follow unified principle, principle clarity, implementation is elegant, update seasonable, very much optimal practice precipitates slowly for regulation, offerred the advantage that a lot of box use namely for broad Javaer, reduce development cost greatly.

Official website is commonly learn and consult the first selection of data of some kind of technology, spring is not exceptional also. Before paragraph time, the my surprizing official website correcting that discovers them, the style is more relaxed small amount, visit rate is rapidder, layout more consecution seeks documentation more convenient. In the time that this front frame emerges in endlessly, the government-owned net front that I have bit of curious Spring and back end are become with what respectively, have what window again? We come one dug unexpectedly.


Framework of analytic website technology has a pretty good tool Wappalyzer, do not use here nevertheless, because source of network of his home official is of a source. Come down source Clone, writing at the beginning above README:

In Addition To The Practical Purpose Of Powering Spring\’s Home On The Web, this Project Is Designed To Serve As A Reference Application- – Resource That Developers Can Use To See How The Spring Team Have Used Spring To Implement A Real-world App With A Few Interesting Requirements. We Hope You\’ll Find It Useful!

Interesting, this project isThe study project that the government recommends, developer can regard a referenced project as this project, acquire Spring group how to implement a true project with Spring from this project. Manufacturing environment namely Spring official net, requirement is specific, do not calculate complex also too won\’t simple, official implementation is sure code quality also has assure, use study first-rate.

  |-- sagan-client
  |-- sagan-renderer
  |-- sagan-site

This is project of much module of a Gradle, the project differentiates by the function 3 stature module. This is a very good practice, assign project code into much stature module by the function.


This is front module, this module uses Node.js And Npm and Webpack to undertake compiling, include the resource that all Web carry:

  • JavaScript module and depend on
  • CSS style
  • Picture and font

This module has 2 to be nodded interestingly, I can learn the way with the detached back end before this plants:

  • It is it calls Npm to compile front with Gradle, that is to say front is compositive also arrive inside Gradle
  • 2 it is it did not use React, the front frame such as Vue. This is a traditional Jquery project, but read code very clear still, and rate is very rapid (can experience in government-owned net directly)


This is apply colours to a drawing module, contracted and not simple, action is the documentation such as Markdown Asciidoc apply colours to a drawing becomes Html. We saw Springboot here a few classical usage, be like

  • Configure automatic infuse, yaml configures OK and automatic infuse mediumly to arrive of need kind in, be likeRendererProperties

  • Spring-boot-starter-hateoas HATEOAS namely Hypertext As The Engine Of Application State, exceed media to use condition engine namely, the 4th in the model that it is the REST maturity that Richardson offers namely highest. Its requirement resource not only have link news, still should have the behavioral news that can carry out, such clients carry OK and dynamic discovery all movements that it can carry out. Spring-boot-starter-hateoas is an implementation of HATEOAS, this storehouse had few points to use it, be likeGuideResource.

  • Call framework of blame tiny service remotely, OK also and convenient use is called remotely, seeGithubClient. Can acquire another very useful method here – a few use Springboot is short storehouse of code download Git:

	 * Download a repository as a zipball
	 * @param organization the github organization name
	 * @param repository the repository name
	 * @return the zipball as raw bytes
	public byte[] downloadRepositoryAsZipball(String organization, String repository) {
		try {
			byte[] response = this.restTemplate.getForObject(REPO_ZIPBALL_PATH,
					byte[].class, organization, repository);
			return response;
		catch (HttpClientErrorException ex) {
			throw new GithubResourceNotFoundException(organization, ex);


This is core module, it is obtained get content, apply colours to a drawing becomes Html, reveal front.
We see it above all is how to be mixedsagan-client Correlation rises. Compare actually simple, add static resource way Springboot to configure a file can, following:

  profiles: standalone
      - file:${client.dir}/build/dist/
        - ../sagan-client/build/dist/
      additional_exclude: \"**/*.js,**/*.css\"

Next it is how to be usedsagan-client Of the service, seeSaganRendererClient. The Mybatis that in addition visible project is not domestic popularity however Jpa, those who pass Springboot-data-jpa add hold, have very strong flexibility and readability. Again my next project, I also can try Jpa possibly.

public interface PostRepository extends JpaRepository<Post, Long> {

    Page<Post> findByCategoryAndDraftFalse(PostCategory category, Pageable pageable);

    Page<Post> findByDraftTrue(Pageable pageRequest);

    @Query(\"select p from Post p where YEAR(p.publishAt) = ?1 and MONTH(p.publishAt) = ?2 and DAY(p.publishAt) = ?3\")
    Page<Post> findByDate(int year, int month, int day, Pageable pageRequest);

Finally, sagan-renderer is a groovy Mvc project, view layer uses Thymeleaf, return the result the browser. Such, whole technological process was finished.

Finally, we will be summed up, what can this project acquire.

  • Project of Gradle much module, include to wait for the conformity of front with Npm
  • Springboot Mvc development, include much environment support, jpa, cache, call remotely, thymeleaf
  • Other and optimal practice, if code standard includes to name with annotate, script, flyway management database changes, tripartite service is like Github, cloudfoundry

Those who thank you read, the welcome visits TOP developer community to communicate communication.

Related Posts

2 thoughts on “The study project Sagan that Spring official net recommends

Leave a Reply

Your email address will not be published. Required fields are marked *