View
32
Download
0
Category
Preview:
Citation preview
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Real-World Boot-Up Sequences:
QuickBooks Self-Employed
By Tim Hobson – Engineer @
About Me
• Software Developer with a bad habit of leveraging frameworks
• Not a fan of re-inventing wheels every project
• Still believe you can move fast with good architecture
2
so old
About Our Product
3
Providing financial management
and compliance solutions for the
Self-Employed in the US and
(soon) globally.
Launched this year and
continuously releasing new
functionality.
very new
Context – In the Beginning…
New to the world offering, evolving product features
Be ready to pivot, pivot, and
pivot again
4
very ambitious
0 customers, aspirations
of millions
0 lines of code
Aggressive timeline for
initial release
Proven scale-ability,
extensibility required
No legacy, but need to
establish patterns early
Dev/Ops Productivity
essential
My Requirements
5
such needs
Powerful AND Simple?
6
?so
inconceivable
Tell us about your experiences with Spring Boot?
• No XML Config? No web.xml?
• Started prototyping with v0.5
• Bugs found, worked around
them
• Engaged with Spring Team
• Saw continual improvement
• …
7
such promise
Growing Pains
• WAR-based deployment
• myBatis Spring
• Understanding magic (Source debugging)
• @Conditional* …
• Cost-benefit analysis of defying convention
• Security customizations
• Web Sockets through multiple routers, apache httpd
8
concern
Tell us about your experiences with Spring Boot?
Cont’d
• Decided to adopt and GO
• Great Success!
• In production since May
• Rolling out new features every few
weeks
• Just released mobile companion
apps
9
amaze
Observations on what made it work
• Sample apps, documentation
• Enthusiasm, Evangelism and Direction from the Spring team
• Accessible source code with tests you can run!
• Developer inclusion in the process – ideas, contributions, fixes
• Truly no xml configuration – ever, as promised
• Massively simplified POMs
• Developer productivity
• Magic
• I would take this framework with me…
10
wow
On The Shoulders of Giants…
• General– @EnableAutoConfiguration– @EnableConfigurationProperties– YAML Configuration & Profiles
– “Starter” Dependency Management
– Boot Actuator
– ResourceBundleMessageSource– @Aspect– @EnableAspectJAutoProxy– @EnableTransactionManagement– @PersistenceContext– @EnableJpaRepositories– @Async– @EnableAsync
• Web– @EnableMvcSecurity– @EnableWebMvcSecurity– @EnableWebSocketMessageBroker– @ControllerAdvice– @ModelAttribute– @ExceptionHandler– SpringBootServletInitializer
• Batch– CRaSH ssh
– @EnableBatchProcessing– @EnableScheduling– @Scheduled– @Job
11
so enabled
What we configured/overrode/extended/built
• General• Data Migration (flywaydb)
• JpaVendorAdapter & EntityManagerFactory
• Batch• Always-on Batch process with @Scheduled
jobs
• On-demand batch job execution using CRaSH groovy commands
• Security• CSRF support for AngularJS
(HttpSessionCsrfTokenRepository)
• Custom Identity/Auth provider for Spring Security
• Hybrid Thymeleaf + Angular UI
• REST Authentication/Authorization
• Session Expiry, Authentication Failure, AccessDenied Handler
• Web• Container Customization (error pages)
• Unsupported Browser handling
• JS Min/SASS Build integration for Maven (exec-maven) calling compass and uglify
• Static asset versioning (git.properties)
12
such customize
Dev/Ops
• Actuator security
• Custom HealthIndicator• Custom Admin web console (leveraging Actuator
APIs, custom health checks) for ops and customer support
• SLF4J Logging with Logback and Splunk-friendly output
• Server-side error logging for Angular client
• On-demand user-level debug logging
• Memcache session storage to support automated rolling deployments
13
very sudo
Testing – Mocks and “System” Testing
14
@EnableAutoConfiguration@Profile("test")
@Beanpublic DataSource dataSource() {
return new EmbeddedDatabaseBuilder().setType(H2).build();}
@ActiveProfiles("test")@WebAppConfiguration@SpringApplicationConfiguration(classes={ApplicationConfig.class, TestConfig.class})…
public class UserControllerTest extends AbstractTestNGSpringContextTests {
private MockMvc mvc;
@BeforeClasspublic void setUp() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();}
@Mockprivate Authentication authentication;…@BeforeTestpublic void setUp() {
MockitoAnnotations.initMocks(this);}
such ease
What’s Next?
15
Reactor
AMQP (RabbitMQ)
spring-session
Spring IO
Thanks!
Questions?
16
@hoserdude
@hoserdude
@hoserdude
hoserdude.com
Recommended