SpringBoot - newgeekorder/TechWiki GitHub Wiki

Static Content

By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources)

Templates

Spring Boot includes auto-configuration support for the following templating engines:

  • FreeMarker, Groovy, Thymeleaf, Velocity, Mustache
  • Note JSPs should be avoided as there are issues for using them with embedded servlets
  • Templates will be picked up automatically from src/main/resources/templates.

Dev and Automatic restart

As part of spring boot 1.3 July 2015 currenly only in the dev repo http://repo.springsource.org/milestone/ Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change.

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
</dependencies>

1.3 also provides

  • Extensive caching support for EhCache, Hazelcast, Infinispan, Redis, Guava or any compliant JSR-107 (JCache) implementation. Cache metric information is now also exposed via the actuator (when the underlying technology supports it).
  • Improved metrics support, include export and aggregation features and big performance improvements if you’re using Java 8.
  • Fully executable JARs for Linux based operating systems, including “service” support. Starting a Boot application as a Linux service is now as easy as typing: sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp.
  • Additional OAuth2 Support, including @EnableAuthorizationServer, @EnableResourceServer and @EnableOAuth2Client annotations.
  • New HealthEndpoints for Elasticsearch, Email and JMS.
  • Maven start and stop goals to help with integration testing.

Run

To allow the the spring-root application to be run from mvn via

mvn spring-boot:run 

Add the spring boot run plugin

<!--  spring boot run  -->
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>1.2.5.RELEASE</version>
    <configuration>
	<addResources>false</addResources>
    </configuration>
</plugin>

Jetty

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

Links and Reference

⚠️ **GitHub.com Fallback** ⚠️