2. 22 2
About Me
Spring framework user
since version 1.0
Curious learner
Savvy runner
Problem solver
Wei Li
Solutions Engineer,
Liberty Mutual Insurance
3. 33 3
Spring Boot in a Nutshell
Dependency management
High productivity
Quality and cloud native
applications
Auto and conditional
configuration
Convention over
configuration
Rich non-functional
features and tooling
Happy developers
4. 44 4
About This Talk - Spring Boot Fundamental
Concepts
Application properties Manage beans
Bean scopeDependency injection
Post startup processingTroubleshooting tips
Be productive
5. 55 5
Application Properties
One property file per
environment Validate properties
Make properties type-safe
(properties => POJO)
Favor YAML file
17. 1717 17
Application Properties – Takeaway
If you define a set of configuration keys for your own components,
we recommend you group them in a POJO annotated with
@ConfigurationProperties. Doing so will provide you with structured,
type-safe object that you can inject into your own beans.
- https://docs.spring.io/spring-boot/docs/current/reference/html/
spring-boot-features.html#boot-features-external-config-vs-value
24. 2424 24
Dependency Injection – Takeaway
The Spring team generally advocates constructor injection, as it lets
you implement application components as immutable objects and
ensures that required dependencies are not null. Furthermore,
constructor-injected components are always returned to the client (calling)
code in a fully initialized state
- https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html
28. 2828 28
Troubleshooting Tips – Leverage Actuator Endpoints
http://localhost:8080/actuator/beans - all beans in the application
http://localhost:8080/actuator/conditions - conditions that were evaluated on
configuration and auto-configuration classes
http://localhost:8080/actuator/configprops - all @ConfigurationProperties
http://localhost:8080/actuator/env - properties from Spring’s ConfigurableEnvironment
http://localhost:8080/actuator/mappings - a list of all @RequestMapping paths
http://localhost:8080/actuator/loggers - the configuration of loggers in the application
38. 3838 38
Be Productive – Use DevTools
Automatic Application
Restart
Browser Refresh by
LiveReload
39. 3939 39
Be Productive – Use Boot Dashboard
Picture copyright - https://spring.io/blog/2015/10/08/the-spring-boot-dashboard-in-sts-part-1-local-boot-apps
Quick access to the
things you do all the
Time during
development