Posts Tagged ‘CDI’
[DevoxxBE2012] Real World Java EE
Adam Bien, a renowned Java consultant, author, and Java Champion with decades of experience in enterprise applications, delivered an impromptu yet insightful session on practical Java EE usage. Adam, known for books like “Real World Java EE Patterns,” shared real-world insights from his freelance projects, emphasizing simplicity and effectiveness over hype.
He started by recounting his journey since 1995, favoring Java EE for its robustness in production. Adam advocated thin WAR deployments, bundling everything into a single archive for easy management, contrasting with complex EAR structures.
Discussing boundaries, Adam promoted domain-driven design, where entities form the core, with services as facades. He cautioned against unnecessary abstractions, like excessive DAOs, favoring direct JPA usage.
Adam highlighted CDI’s power for dependency injection, reducing boilerplate. He demonstrated boundary-control-entity patterns, where boundaries handle transactions, controls manage logic, and entities persist data.
Deployment Strategies and Simplicity
Adam stressed deploying as WARs to containers like GlassFish, avoiding heavy setups. He shared experiences with microservices avant la lettre, using REST for inter-service communication.
He critiqued over-engineering, like misusing ESBs for simple integrations, preferring lightweight approaches.
Testing and Quality Assurance
Adam advocated comprehensive testing: unit with JUnit, integration with Arquillian, and UI with Selenium/Graphene. He demonstrated embedding containers for realistic tests.
He emphasized boundary testing, simulating real scenarios without mocks where possible.
Performance and Scalability
Discussing optimization, Adam noted Java EE’s built-in clustering, but advised measuring first. He shared cases where simple configurations sufficed, avoiding premature scaling.
Community and Best Practices
Adam encouraged open-source contributions, sharing his GitHub projects. He addressed common pitfalls, like session misuse, advocating stateless designs.
In Q&A, he discussed tools like Jenkins for CI and IDEs like IntelliJ.
Adam’s talk reinforced Java EE’s viability for real-world applications through pragmatic, lean practices.
Links:
[DevoxxBE2012] Weld-OSGi in Action
Mathieu Ancelin and Matthieu Clochard, software engineers at SERLI specializing in Java EE and modular systems, showcased the synergy between CDI, OSGi, and Weld in their Weld-OSGi framework during DevoxxBE2012. Mathieu, a member of the CDI 1.1 expert group and contributor to projects like GlassFish, collaborated with Matthieu, who focuses on OSGi integrations, to demonstrate how Weld-OSGi simplifies dynamic application assembly without added complexity.
They started with CDI basics, where dependency injection manages component lifecycles via annotations like @Inject. OSGi’s modularity, with bundles as deployment units and a dynamic service registry, complements this by allowing runtime changes. Weld-OSGi bridges them, enabling CDI beans to interact seamlessly with OSGi services.
A demo illustrated bootstrapping Weld-OSGi in an OSGi environment, registering bundles, and using extensions for event handling. They emphasized transparent service interactions, where CDI observes OSGi events for dynamic updates.
Mathieu and Matthieu highlighted Weld-OSGi’s role in making OSGi accessible, countering perceptions of its difficulty by leveraging CDI’s programming model.
Fundamentals of CDI and OSGi Integration
Mathieu explained CDI’s bean management, scopes, and qualifiers for precise injections. Matthieu detailed OSGi’s bundle lifecycle and service registry, where services publish and consume dynamically.
Weld-OSGi embeds CDI containers in OSGi, using extensions to observe bundle events and register services as beans. This allows injecting OSGi services into CDI components effortlessly.
Dynamic Features and Practical Demonstrations
They demonstrated service dynamism: publishing a service updates dependent beans automatically. Unpublishing triggers alternatives or errors, ensuring robustness.
Demos included hybrid applications where Java EE components interact with OSGi bundles via the registry, deploying parts dynamically without restarts.
Future Prospects and Community Engagement
Mathieu discussed ongoing work for hybrid servers like GlassFish, embedding Weld-OSGi for cleaner integrations. They referenced RFC 146, inspired by Weld-OSGi, for native CDI-OSGi support.
Encouraging trials, they pointed to GitHub repositories with examples and documentation, fostering feedback to evolve the framework.
Mathieu and Matthieu’s presentation illustrated Weld-OSGi’s potential to create fully dynamic modular applications, blending CDI’s elegance with OSGi’s power.
Links:
[DevoxxBE2012] Raise Your Java EE 6 Productivity Bar with JBoss Forge
Koen Aers, a Red Hat engineer driving Eclipse integration for JBoss Forge, alongside guest Ivan St. Ivanov from SAP, explored boosting Java EE 6 development efficiency. Koen, with a background in jBPM and workflow editors, refreshed on Forge’s role in simplifying complex setups for novices.
Forge, a command-line tool using CDI, incrementally adds features to projects. Commands scaffold entities, UI, and services swiftly.
They demonstrated creating a project, adding persistence with JPA, generating entities like Speaker and Session, and scaffolding JSF views.
For tasks beyond built-ins, plugins extend functionality. Ivan showed developing an Envers plugin for auditing, installing it, and applying to entities.
Integration with IDEs like Eclipse opens Forge’s power graphically.
Their demo built a conference app, adding history views with auditing, showcasing rapid enhancements.
Koen and Ivan emphasized Forge’s elevation of productivity, enabling faster iterations.
Introducing Forge and Basic Workflows
Koen explained Forge’s shell for navigating projects, setting up Maven builds, and adding facets like JPA for persistence.xml configuration.
Commands generate entities with fields, relationships via annotations.
Scaffolding and UI Generation
Scaffolding creates CRUD operations and JSF views from entities, deploying to servers like AS7.
They customized views, adding fields and relations.
Extending with Plugins
Ivan illustrated plugin creation: facets detect capabilities, commands execute actions like adding dependencies.
The Envers plugin audited entities, integrating seamlessly.
IDE Integration and Real-World Application
Eclipse plugins embed Forge consoles, enhancing workflows.
In demo, they audited entities, added history beans, and viewed changes, proving incremental power.
Koen and Ivan’s insights highlighted Forge’s transformative impact on Java EE development.
Links:
[DevoxxBE2012] Apache TomEE: Java EE 6 Web Profile on Tomcat
David Blevins, a veteran in open-source Java EE and founder of projects like OpenEJB and TomEE, showcased Apache TomEE. With over a decade in specifications like EJB and CDI, David positioned TomEE as a bridge for Tomcat users seeking Java EE capabilities.
He polled the audience, revealing widespread Tomcat use alongside other servers, highlighting the migration pain TomEE addresses. David described TomEE as Tomcat enhanced with Java EE, unzipping Tomcat, adding Apache projects like OpenJPA and CXF, then certifying the bundle.
Emphasizing small size, certification, and Tomcat fidelity, David outlined distributions: Web Profile (minimal specs), JAX-RS (adding REST), and Plus (including JMS, JAX-WS).
Understanding the Web Profile
David clarified the Java EE 6 Web Profile, a subset of 12 specs from the full 24, excluding outdated ones like CORBA and CMP. This acknowledges Java EE’s growth, focusing on essentials for modern apps.
He noted exclusions like JAX-RS (added in EE 7) and inclusions like JavaMail in TomEE’s Web Profile for practicality. David projected EE 7’s profile reductions, potentially enabling full-profile TomEE certification.
Demonstrating TomEE in Action
In a live demo, David set up TomEE in Eclipse using Tomcat adapters, creating a servlet with EJB injection and JPA. He deployed seamlessly, showcasing CDI, transactions, and web services, all within Tomcat’s familiar environment.
David highlighted TomEE’s lightweight footprint—under 30MB—booting quickly with low memory. He integrated tools like Arquillian for testing, demonstrating in-container and embedded modes.
Advanced Features and Configuration
David explored clustering with Hazelcast, enabling session replication without code changes. He discussed production readiness, citing users like OpenShift and Jelastic.
Configuration innovations include flat XML-properties hybrids, human-readable times (e.g., “2 minutes”), and dynamic resource creation. David showed overriding via command-line or properties, extending for custom objects injectable via @Resource.
Error handling stands out: TomEE collects all deployment issues before failing, providing detailed, multi-level feedback to accelerate fixes.
Community and Future Directions
Celebrating TomEE’s first year, David shared growth metrics—surging commits and mailing lists—inviting contributions. He mentioned production adopters praising its simplicity and performance.
David announced a logo contest, encouraging participation. In Q&A, he affirmed production use, low memory needs, and solid components like OpenJPA.
Overall, David’s talk positioned TomEE as an empowering evolution for Tomcat loyalists, blending familiarity with Java EE power.