Post on 14-Jul-2015
transcript
About author
• Works in IT since 2000• 11 years of Java SE/EE experience• Java lecturer• Multiple speaker at Java User Group• Winner of 2013 Jboss Community
Recognition Award https://www.jboss.org/jbcra
Spring Boot
• Stand-alone Spring applications • Embed Tomcat or Jetty directly (no need
to deploy WAR files)• Automatically Spring configuration• Absolutely no code generation and no requirement for XML configuration• Convention-over-configuration• Focus on business features and less oninfrastructure
Starters concept
• Aggregate modules• Trusted versions of libraries• Similar to micro-service architecture
Starters concept
• spring-boot-starter-actuator• spring-boot-starter-data-jpa• spring-boot-starter-jdbc• spring-boot-starter-jersey• spring-boot-starter-logging• spring-boot-starter-mobile• spring-boot-starter-redis• spring-boot-starter-test• spring-boot-starter-web
Auto-configuration
• AopAutoConfiguration• JpaRepositoriesAutoConfiguration• HibernateJpaAutoConfiguration• DataSourceAutoConfiguration• JmsTemplateAutoConfiguration• MongoAutoConfiguration• RedisAutoConfiguration• WebMvcAutoConfiguration• SecurityAutoConfiguration
Properties
Class Prefix
MessageSourceAutoConfiguration spring.messages
BatchProperties spring.batch
ElasticsearchProperties spring.data.elasticsearch
FreeMarkerProperties spring.freemarker
JacksonProperties spring.jackson
DataSourceProperties spring.datasource
JerseyProperties spring.jersey
MailProperties spring.mail
MongoProperties spring.data.mongodb
SecurityProperties security
WebMvcProperties spring.mvc
Spring Boot Actuator
• Helps manage and monitor applications when pushed to production
• Accessible via HTTP, JMX or remote shell
Spring Boot Actuator
• Series of endpoints to help manage your Spring application• Reads properties and spring beans and then returns a JSON view• Allows direct access to non functional
application information without having to open an IDE or a command prompt
Spring Boot Actuator
• /info• /health• /beans• /env• /dump• /metrics• /trace• /autoconfigurationreport• /shutdown
Spring Boot Actuator.Metrics
• Includes a metrics service with ‘gauge’ and ‘counter’ support
• A ‘gauge’ records a single value; and a ‘counter’ records a delta (an increment or decrement)
• Metrics for all HTTP requests are automatically recorded
Spring Boot Actuator.Metrics
• System metrics• Datasource metrics• WebServer metrics• Custom metrics
Pro
• No configuration files• Auto-configuration• Maven, Gradle & Ant integration• Embedded servers: Tomcat, Jetty and
Undertow• Configuration for multiple Java
technologies• Monitoring & management out-of-box
Dropwizard
• Lightweight alternative• REST web services support using Jersey• Embedded servers• Logging and validation• Templating systems• Metrics library