The document discusses concepts and examples related to dependency injection in Java EE and CDI frameworks. It begins with basic examples of using @Inject to inject dependencies, and progresses to more advanced topics like producer methods, qualifiers, alternative implementations, custom scopes and extensions. It also discusses how to test CDI components using Arquillian and DeltaSpike. Throughout the document, examples are provided and potential issues or missing pieces are raised for discussion.
The document discusses concepts related to productive, simple, and modern application development. It introduces the concepts of dependency injection and contextual conversations in CDI, including scopes, qualifiers, stereotypes, events, and extensions. It also discusses integrating Spring components into CDI and the goals of the Seam 3 Spring module.
The document discusses various aspects of Contexts and Dependency Injection (CDI) in Java EE, including how to use @Inject for dependency injection, qualifiers to select specific implementations, producers to provide dependencies, and events to communicate between components in a loosely coupled way. It also demonstrates CDI concepts like qualifiers, producers, scopes, and alternatives through examples.
This document discusses dependency injection in CDI. It begins with a brief history of CDI and then covers the different ways that dependencies can be injected including via attributes, constructors, setters, qualifiers and programmatic lookup. It also discusses how to inject producers like entity managers and how CDI enables loose coupling and strong typing. The document concludes by emphasizing that CDI is capable of much more than just dependency injection.
The document provides an overview of the Android infrastructure and key concepts:
(1) It describes the layers of an Android application including the presentation layer, application logic layer, and domain layer.
(2) It explains important Android concepts such as the Android runtime environment, Dalvik virtual machine, application lifecycle and activities, and use of contexts.
(3) It discusses alternatives for common tasks like dependency injection with RoboGuice and Dagger, handling resources and views with ButterKnife and AndroidAnnotations, and accessing data with SQLite and ORMLite.
(4) It also briefly covers testing approaches on the DVM and JVM using AndroidTestCase, Robotium, and Robolectric
This document provides an overview of event sourcing and CQRS approaches to system architecture. It discusses command handling, view handling, and writing event sourced DDD systems. It provides code examples of modeling commands, events, and aggregates in an event sourced system. It discusses benefits of event sourcing like having an audit log, horizontal scaling, and using events to power other services.
Tomasz Polanski - Automated mobile testing 2016 - Testing: why, when, howTomasz Polanski
The document discusses testing and some common objections to writing tests. It addresses concerns like tests taking too much time, specs changing too often, tests being difficult to understand, and whether there are too many tests or too much code. It provides examples of simple, readable tests and discusses test-driven development principles like writing just enough tests to feel confident in changes without going overboard.
The document discusses concepts related to productive, simple, and modern application development. It introduces the concepts of dependency injection and contextual conversations in CDI, including scopes, qualifiers, stereotypes, events, and extensions. It also discusses integrating Spring components into CDI and the goals of the Seam 3 Spring module.
The document discusses various aspects of Contexts and Dependency Injection (CDI) in Java EE, including how to use @Inject for dependency injection, qualifiers to select specific implementations, producers to provide dependencies, and events to communicate between components in a loosely coupled way. It also demonstrates CDI concepts like qualifiers, producers, scopes, and alternatives through examples.
This document discusses dependency injection in CDI. It begins with a brief history of CDI and then covers the different ways that dependencies can be injected including via attributes, constructors, setters, qualifiers and programmatic lookup. It also discusses how to inject producers like entity managers and how CDI enables loose coupling and strong typing. The document concludes by emphasizing that CDI is capable of much more than just dependency injection.
The document provides an overview of the Android infrastructure and key concepts:
(1) It describes the layers of an Android application including the presentation layer, application logic layer, and domain layer.
(2) It explains important Android concepts such as the Android runtime environment, Dalvik virtual machine, application lifecycle and activities, and use of contexts.
(3) It discusses alternatives for common tasks like dependency injection with RoboGuice and Dagger, handling resources and views with ButterKnife and AndroidAnnotations, and accessing data with SQLite and ORMLite.
(4) It also briefly covers testing approaches on the DVM and JVM using AndroidTestCase, Robotium, and Robolectric
This document provides an overview of event sourcing and CQRS approaches to system architecture. It discusses command handling, view handling, and writing event sourced DDD systems. It provides code examples of modeling commands, events, and aggregates in an event sourced system. It discusses benefits of event sourcing like having an audit log, horizontal scaling, and using events to power other services.
Tomasz Polanski - Automated mobile testing 2016 - Testing: why, when, howTomasz Polanski
The document discusses testing and some common objections to writing tests. It addresses concerns like tests taking too much time, specs changing too often, tests being difficult to understand, and whether there are too many tests or too much code. It provides examples of simple, readable tests and discusses test-driven development principles like writing just enough tests to feel confident in changes without going overboard.
Code to DI For - Dependency Injection for Modern ApplicationsCaleb Jenkins
This talk introduces the concepts of factories, strategy pattern, Inversion of Control, dependency injection and several of the available frameworks. We'll also look at common dependency injection patterns and various IoC/DI frameworks, the pros & cons, practical steps and guidance as well some of the real world scenarios with impact to unit testing and application architecture.
First presented at the Ft. Worth .NET Users Group on March 15th, 2016 - http://developingux.com/2016/03/14/code-to-di-for-in-ft-worth/ - Code will be posted to my GitHub soon! https://github.com/calebjenkins/ (Talks.Code-to-DI-For)
- The document discusses Java libraries for building applications that consume REST APIs, with an emphasis on small, reusable components and easy testing.
- It recommends libraries for dependency injection (Guice, Spring), HTTP clients (OkHttp), REST clients (Retrofit), reducing boilerplate (Lombok), reactive programming (RxJava), logging (SLF4J), testing (JUnitParams, Mockito, WireMock), and other tasks.
- Code examples are provided to illustrate how to use several of the libraries for common tasks like dependency injection, HTTP requests, and testing HTTP responses.
Documentation: https://izumi.7mind.io/latest/release/doc/distage/
Github: https://github.com/pshirshov/izumi-r2
Pavel Shirshov - DIStage: purely functional programming without sacrificing modularity with modern dependency injection for Scala
- Modularity and its importance
- DI-like mechanisms and their issues in Scala
- Why people think that "DI doesn't compose with functional programming", and why that's not true
- Designing a staged DI, for wiring at runtime, at compile-time, or mixed
- Staging programs for reliability, power and performance
- The pains of supporting rich Scala types (incl. How to emulate kind-polymorphism in Scala 2)
- Garbage collection in DI for better tests and deployments
Pavel's bio: Language-agnostic software engineer, coding for 18 years,
10 years of hands-on commercial engineering experience.
Led a cluster orchestration team at Yandex, "the Russian Google"; implemented an internal orchestration solution, "ISS" (Scala/Java/C++), managing 50K+ physical hosts across 6 datacenters.
Today, Pavel owns Irish R&D company Septimal Mind.
The document contains code snippets related to Java classes and engineers. It defines classes like JavaEngineer and JavaJaEngineer that extend an abstract Engineer class. It also includes code for initializing engineer objects and setting their class types. The document includes HTML, JSP, and Django template code for rendering web pages related to engineers.
The document discusses several design patterns including creational patterns like abstract factory, builder, factory method, and prototype which are used to create objects, as well as structural patterns like adapter and bridge which connect classes and support inheritance, and behavioral patterns like strategy and state which alter object behavior. Code examples are provided to illustrate how to implement abstract factory, builder, factory method, prototype, and singleton patterns.
Modularizing a project is never easy, a lot of files to move and the dependencies between them is not always what we expect. Then the Dagger configuration used in a single module project often doesn't scale well to a multi module project. Hilt is opinionated about the configuration to use (we don't need to argue anymore about using component dependencies or subcomponents!) and this configuration works perfectly even in a multi module project. In this talk we'll see first an introduction to Hilt and a comparison with Dagger to understand why it's easier to configure. Then we'll see how to leverage it in a multi module project (both in a standard layered architecture and in a Clean Architecture that uses the Dependency Inversion) to improve build speed and code testability. Spoiler alert: using sample apps that include a single feature in the app helps a lot!
Demystifying dependency Injection: Dagger and ToothpickDanny Preussler
Dependency Injection, that's the thing that Dagger2 does, right? For most of us, it's black magic. Let's look deeper how DI works. And then we better understand the frameworks that are out there. This session introduce Toothpick that was created this year and is already used by millions of users as driven a lot by engineers at Groupon.
What was their need? What's wrong with Dagger?
Toothpick was designed to bring goodies from Guice to modern mobile world. It focuses on scopes and unit testing without loosing performance as Roboguice did.
This document outlines the necessary software and tools for a project including Java Runtime Environment (JRE) and Java Development Kit (JDK) from Oracle, Android Studio and Android Development Tools (ADT) from Google, version control through Git and GitHub, and the Gradle build system.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
This is the support of a course to teach mainly Redux, and Redux with React for Java and C# programmers. It is the third part of the course to recycle programmers from desktop app programming to web app programming. This course covers from history of Redux, its origin, step by step what is a reducer, and later concepts like reducer splitting, action handling, async and many more.
You also can use repositories:
- https://github.com/drpicox/learn-redux-bytesting
- https://github.com/drpicox/learn-redux-zoo-bytesting
To improve your skills.
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)Danny Preussler
1. The document provides 15 tips for improving unit tests, focusing on readability, consistent naming conventions, using matchers over basic asserts, moving setup code out of test methods, adding matchers for custom models, using null objects to reduce test garbage, and writing tests that fail to ensure quality code.
2. Key tips include giving tests readable names, reducing noise in tests, implementing equals on test models, using reflection code fluently, and inverting control for testability even if it breaks encapsulation.
3. The document emphasizes that tests should prioritize readability and maintainability over strict adherence to "unit" sizes, and that if all tests pass without failing, better tests need to be written to
The document discusses dependency injection (DI) using Dagger 2 in Java. It begins by showing an example of traditional Java code without DI and the issues it can cause. It then introduces DI and how Dagger 2 implements it using annotations and compile-time validation. Key features of Dagger 2 highlighted include its Android compatibility, JSR-330 support, and generated code for easy debugging. The document provides examples of Dagger 2 annotations and APIs for declaring modules, components, scopes, lazy injection, and qualifiers. Overall it serves as an introduction to dependency injection using Dagger 2 in Java applications.
Contextual communications and why you should care - Droidcon DEMarcos Placona
Communication is the key to everything. From the time you wake up and and press a button on your coffee-machine to tell you to make you a coffee, to when you talk to your other half to make plans for a night out, a trip or your own wedding. Imagine a world where each time when you wanted to do your grocery shopping, you first had to stop at the bank to make sure the funds were clear. Or whenever you wanted to drive from home to work you had to first stop at a petrol station to check whether your car had enough petrol to make the journey.
In this talk I will show you some common scenarios where we are currently doing just that with our websites or mobile apps and not even thinking about it. We will then look at some ways we can avoid that and bring context back onto our applications.
This document discusses using JavaFX for building business applications. It describes a sample conference planning application built with JavaFX and its architecture including the user experience designer, developer, and graphical designer roles. It also outlines the process of defining the application view, data binding, and styling with CSS.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
The summary provides an overview of the key points about Guice 2.0 covered in the document:
Guice 2.0 was released in May 2009 and introduced several new features such as provider methods, binding overrides, multi-bindings, map-bindings, and private modules. It also supports third party modules for testing and other languages.
Data Binding is an official Google library that allows binding UI components in layouts to data sources in apps. It generates bindings during compilation that match views to variables, and automatically executes changes to UI when data is updated. This avoids manually finding views by ID and setting values, and makes it easier to update UIs when data changes occur.
Unit testing in Kotlin provides benefits like documenting code, promoting good design, and creating a safety net around code. Tests can be improved by using features like multiline strings, factory functions with named arguments, better mocking with Mockito-Kotlin, and assertions with Kluent. Migrating existing Java unit tests to Kotlin allows leveraging these modern features for more expressive and readable tests.
Secret unit testing tools no one ever told you aboutDror Helper
There are more to unit testing than using a unit testing framework – in order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about – some enabling creating of top-notch, robust unit tests. Some will help you run your tests better and faster.
In this session I’ll explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits and how unit level BDD, AutoMocking, and Continuous Execution can help take control over your tests.
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
Multi Client Development with Spring - Josh Long jaxconf
This document provides an overview of Spring's support for building multi-client web applications. It discusses Spring's servlet support including the Servlet 3.0 initializer classes. It also covers Spring MVC, building mobile-friendly applications, native Android development with Spring, REST support, and securing applications with Spring Security. The document contains examples of core Spring features like controllers and uses diagrams to illustrate classic Spring MVC architecture. It aims to demonstrate these techniques through examples and code snippets.
This document discusses using the VRaptor web framework with CDI in a Java EE environment. It covers how to configure VRaptor controllers using CDI annotations, inject dependencies, handle requests and responses, validate user input, manage transactions and persistence with JPA, and leverage other Java EE features like EJBs. It also describes how VRaptor integrates with the Java EE platform and additional functionality provided by VRaptor plugins.
Code to DI For - Dependency Injection for Modern ApplicationsCaleb Jenkins
This talk introduces the concepts of factories, strategy pattern, Inversion of Control, dependency injection and several of the available frameworks. We'll also look at common dependency injection patterns and various IoC/DI frameworks, the pros & cons, practical steps and guidance as well some of the real world scenarios with impact to unit testing and application architecture.
First presented at the Ft. Worth .NET Users Group on March 15th, 2016 - http://developingux.com/2016/03/14/code-to-di-for-in-ft-worth/ - Code will be posted to my GitHub soon! https://github.com/calebjenkins/ (Talks.Code-to-DI-For)
- The document discusses Java libraries for building applications that consume REST APIs, with an emphasis on small, reusable components and easy testing.
- It recommends libraries for dependency injection (Guice, Spring), HTTP clients (OkHttp), REST clients (Retrofit), reducing boilerplate (Lombok), reactive programming (RxJava), logging (SLF4J), testing (JUnitParams, Mockito, WireMock), and other tasks.
- Code examples are provided to illustrate how to use several of the libraries for common tasks like dependency injection, HTTP requests, and testing HTTP responses.
Documentation: https://izumi.7mind.io/latest/release/doc/distage/
Github: https://github.com/pshirshov/izumi-r2
Pavel Shirshov - DIStage: purely functional programming without sacrificing modularity with modern dependency injection for Scala
- Modularity and its importance
- DI-like mechanisms and their issues in Scala
- Why people think that "DI doesn't compose with functional programming", and why that's not true
- Designing a staged DI, for wiring at runtime, at compile-time, or mixed
- Staging programs for reliability, power and performance
- The pains of supporting rich Scala types (incl. How to emulate kind-polymorphism in Scala 2)
- Garbage collection in DI for better tests and deployments
Pavel's bio: Language-agnostic software engineer, coding for 18 years,
10 years of hands-on commercial engineering experience.
Led a cluster orchestration team at Yandex, "the Russian Google"; implemented an internal orchestration solution, "ISS" (Scala/Java/C++), managing 50K+ physical hosts across 6 datacenters.
Today, Pavel owns Irish R&D company Septimal Mind.
The document contains code snippets related to Java classes and engineers. It defines classes like JavaEngineer and JavaJaEngineer that extend an abstract Engineer class. It also includes code for initializing engineer objects and setting their class types. The document includes HTML, JSP, and Django template code for rendering web pages related to engineers.
The document discusses several design patterns including creational patterns like abstract factory, builder, factory method, and prototype which are used to create objects, as well as structural patterns like adapter and bridge which connect classes and support inheritance, and behavioral patterns like strategy and state which alter object behavior. Code examples are provided to illustrate how to implement abstract factory, builder, factory method, prototype, and singleton patterns.
Modularizing a project is never easy, a lot of files to move and the dependencies between them is not always what we expect. Then the Dagger configuration used in a single module project often doesn't scale well to a multi module project. Hilt is opinionated about the configuration to use (we don't need to argue anymore about using component dependencies or subcomponents!) and this configuration works perfectly even in a multi module project. In this talk we'll see first an introduction to Hilt and a comparison with Dagger to understand why it's easier to configure. Then we'll see how to leverage it in a multi module project (both in a standard layered architecture and in a Clean Architecture that uses the Dependency Inversion) to improve build speed and code testability. Spoiler alert: using sample apps that include a single feature in the app helps a lot!
Demystifying dependency Injection: Dagger and ToothpickDanny Preussler
Dependency Injection, that's the thing that Dagger2 does, right? For most of us, it's black magic. Let's look deeper how DI works. And then we better understand the frameworks that are out there. This session introduce Toothpick that was created this year and is already used by millions of users as driven a lot by engineers at Groupon.
What was their need? What's wrong with Dagger?
Toothpick was designed to bring goodies from Guice to modern mobile world. It focuses on scopes and unit testing without loosing performance as Roboguice did.
This document outlines the necessary software and tools for a project including Java Runtime Environment (JRE) and Java Development Kit (JDK) from Oracle, Android Studio and Android Development Tools (ADT) from Google, version control through Git and GitHub, and the Gradle build system.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
This is the support of a course to teach mainly Redux, and Redux with React for Java and C# programmers. It is the third part of the course to recycle programmers from desktop app programming to web app programming. This course covers from history of Redux, its origin, step by step what is a reducer, and later concepts like reducer splitting, action handling, async and many more.
You also can use repositories:
- https://github.com/drpicox/learn-redux-bytesting
- https://github.com/drpicox/learn-redux-zoo-bytesting
To improve your skills.
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)Danny Preussler
1. The document provides 15 tips for improving unit tests, focusing on readability, consistent naming conventions, using matchers over basic asserts, moving setup code out of test methods, adding matchers for custom models, using null objects to reduce test garbage, and writing tests that fail to ensure quality code.
2. Key tips include giving tests readable names, reducing noise in tests, implementing equals on test models, using reflection code fluently, and inverting control for testability even if it breaks encapsulation.
3. The document emphasizes that tests should prioritize readability and maintainability over strict adherence to "unit" sizes, and that if all tests pass without failing, better tests need to be written to
The document discusses dependency injection (DI) using Dagger 2 in Java. It begins by showing an example of traditional Java code without DI and the issues it can cause. It then introduces DI and how Dagger 2 implements it using annotations and compile-time validation. Key features of Dagger 2 highlighted include its Android compatibility, JSR-330 support, and generated code for easy debugging. The document provides examples of Dagger 2 annotations and APIs for declaring modules, components, scopes, lazy injection, and qualifiers. Overall it serves as an introduction to dependency injection using Dagger 2 in Java applications.
Contextual communications and why you should care - Droidcon DEMarcos Placona
Communication is the key to everything. From the time you wake up and and press a button on your coffee-machine to tell you to make you a coffee, to when you talk to your other half to make plans for a night out, a trip or your own wedding. Imagine a world where each time when you wanted to do your grocery shopping, you first had to stop at the bank to make sure the funds were clear. Or whenever you wanted to drive from home to work you had to first stop at a petrol station to check whether your car had enough petrol to make the journey.
In this talk I will show you some common scenarios where we are currently doing just that with our websites or mobile apps and not even thinking about it. We will then look at some ways we can avoid that and bring context back onto our applications.
This document discusses using JavaFX for building business applications. It describes a sample conference planning application built with JavaFX and its architecture including the user experience designer, developer, and graphical designer roles. It also outlines the process of defining the application view, data binding, and styling with CSS.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
The summary provides an overview of the key points about Guice 2.0 covered in the document:
Guice 2.0 was released in May 2009 and introduced several new features such as provider methods, binding overrides, multi-bindings, map-bindings, and private modules. It also supports third party modules for testing and other languages.
Data Binding is an official Google library that allows binding UI components in layouts to data sources in apps. It generates bindings during compilation that match views to variables, and automatically executes changes to UI when data is updated. This avoids manually finding views by ID and setting values, and makes it easier to update UIs when data changes occur.
Unit testing in Kotlin provides benefits like documenting code, promoting good design, and creating a safety net around code. Tests can be improved by using features like multiline strings, factory functions with named arguments, better mocking with Mockito-Kotlin, and assertions with Kluent. Migrating existing Java unit tests to Kotlin allows leveraging these modern features for more expressive and readable tests.
Secret unit testing tools no one ever told you aboutDror Helper
There are more to unit testing than using a unit testing framework – in order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about – some enabling creating of top-notch, robust unit tests. Some will help you run your tests better and faster.
In this session I’ll explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits and how unit level BDD, AutoMocking, and Continuous Execution can help take control over your tests.
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
Multi Client Development with Spring - Josh Long jaxconf
This document provides an overview of Spring's support for building multi-client web applications. It discusses Spring's servlet support including the Servlet 3.0 initializer classes. It also covers Spring MVC, building mobile-friendly applications, native Android development with Spring, REST support, and securing applications with Spring Security. The document contains examples of core Spring features like controllers and uses diagrams to illustrate classic Spring MVC architecture. It aims to demonstrate these techniques through examples and code snippets.
This document discusses using the VRaptor web framework with CDI in a Java EE environment. It covers how to configure VRaptor controllers using CDI annotations, inject dependencies, handle requests and responses, validate user input, manage transactions and persistence with JPA, and leverage other Java EE features like EJBs. It also describes how VRaptor integrates with the Java EE platform and additional functionality provided by VRaptor plugins.
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
The document discusses the Japan Grails/Groovy User Group (JGGUG). It notes that their next meeting will be on September 9-11 and will cover the Grails Acegi Plugin. It also provides links to the group's website and a twitter account for updates. Additionally, it shows examples of using Groovy and Grails for a web application that can be deployed to Google App Engine.
ActiveWeb: Chicago Java User Group Presentationipolevoy
- ActiveWeb is a Java web framework that aims to make web programming fun and productive again through its simplicity, support for TDD, and immediate feedback.
- It provides convention over configuration routing and views, dependency injection with Guice, and integrates well with testing frameworks like allowing parameters to be passed to controllers and inspecting HTML responses.
- ActiveWeb has no XML configuration and aims to have as few dependencies as possible while still providing a full-stack framework for building RESTful web services and traditional MVC applications.
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Template forms allow creating forms directly in the template using directives like ngModel. Reactive forms use FormBuilder to build forms programmatically and attach validators and value changes. Both approaches allow collecting and validating user input, and associating forms with models. Forms are a key part of many applications for user input and data collection.
Лаконічні та елегантні автоматизовані тести? Безболісний (майже) тестовий стек для UI веб-додатків? Більше часу, щоб випити кави/пограти у Cuphead/ подивитись у порожнечу?
Ми поговоримо про Lombok, Vavr, Owner, чому вам варто використовувати готові рішення та як зробити тести більш лаконічними та читабельними. Вам знадобиться Vaper та/або гіроборд.
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
Groovy is a dynamic language for the Java Virtual Machine that integrates with Java. Grails is a web framework built on Groovy that leverages existing Java technologies. The presentation discusses how Groovy's meta-programming capabilities, through its Meta Object Protocol, enable new patterns like dynamic finders that change how we approach common Java patterns like the Data Access Object and Service Locator.
This document discusses integration patterns in Adobe Experience Manager (AEM), including using Sling Models for dependency injection and accessing resources from different locations through a single ResourceResolver. It provides examples of integrating with backend APIs, databases, file systems and forms using techniques like ResourceProviders, Sling Filters and custom SlingServlets. It also covers accessing files from bundles and the filesystem using BundleResourceProvider and FsResourceProvider respectively.
This document provides an overview and introduction to Laravel 5, a PHP web application framework. It discusses key Laravel 5 concepts and features such as Eloquent ORM, routing, middleware, contracts, form requests, the IoC container, file drivers, scheduling commands, and the command bus pattern. The document is intended to explain Laravel 5 concepts through code examples and brief explanations.
There are more smart people building software now than there have been at any point in the past, which means that it's more important than ever to stay on top of new developments, libraries, frameworks, and everything else. To really take advantage of this wealth of innovation, however, you've got to look beyond your normal community -- what's going on in Python? And how can we use that to make our Ruby lives easier? In this session, we'll explore that question. We'll look at actual examples of code and concepts borrowed and reimplemented to form a better idea of when it's appropriate and when it'll fall flat.
The test class DuckDuckGoTest uses FluentLenium to test the DuckDuckGo search engine. It contains a test method that searches for "FluentLenium", verifies the title contains the search query, and a getWebDriver method that sets up the Chrome driver for tests. The Build.gradle file lists the FluentLenium and Selenium dependencies needed to run the tests.
The document discusses using vfsStream to mock the filesystem in unit tests. vfsStream provides a virtual filesystem that uses PHP streams, allowing tests to manipulate files and directories without interacting with the real filesystem. It describes how to set up vfsStream, create and interact with virtual files and directories, and a vfsStream PHPUnit helper that simplifies its integration with PHPUnit tests.
4Developers 2015: Be pragmatic, be SOLID - Krzysztof MenżykPROIDEA
Krzysztof Menżyk
Language: Polish
Wiemy jak projektować dobry kod obiektowy? Ilu z nas zna 5 zasad SOLID? Ilu z nas przestrzega ich w codziennej pracy z kodem? Nie tylko wyjaśnię co to SOLID, ale również pokażę, że to nie sucha teoria a praktyczne rady, które warto aplikować w naszych projektach.
Podczas prezentacji szczegółowo omówię każdą z pięciu zasad. Pokażę konkretne przykłady, które naruszają ww. zasady. Zaprezentuję przykładowe rozwiązania i techniki refaktorowania kodu. Omówię również, w jakich sytuacjach można pominąć niektóre z zasad oraz jaki może to mieć wpływ na projekt.
The document summarizes the key features of Groovy and how to get started using Groovy in Eclipse. It begins with an introduction to Groovy and its benefits compared to Java. It then walks through converting a simple "Hello World" Java program to Groovy. The remaining sections outline important Groovy features like closures and iterators, and how to install the Groovy Eclipse plugin.
The easy way to develop Java applications has always been the standard stack (Spring, JEE, SQL) that confirms the LAMP equivalent in Java-speak. This presentation compares this model with a real use case based on Guice, Jersey and AppEngine.
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Tatiana Kojar
Skybuffer AI, built on the robust SAP Business Technology Platform (SAP BTP), is the latest and most advanced version of our AI development, reaffirming our commitment to delivering top-tier AI solutions. Skybuffer AI harnesses all the innovative capabilities of the SAP BTP in the AI domain, from Conversational AI to cutting-edge Generative AI and Retrieval-Augmented Generation (RAG). It also helps SAP customers safeguard their investments into SAP Conversational AI and ensure a seamless, one-click transition to SAP Business AI.
With Skybuffer AI, various AI models can be integrated into a single communication channel such as Microsoft Teams. This integration empowers business users with insights drawn from SAP backend systems, enterprise documents, and the expansive knowledge of Generative AI. And the best part of it is that it is all managed through our intuitive no-code Action Server interface, requiring no extensive coding knowledge and making the advanced AI accessible to more users.
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxSitimaJohn
Ocean Lotus cyber threat actors represent a sophisticated, persistent, and politically motivated group that poses a significant risk to organizations and individuals in the Southeast Asian region. Their continuous evolution and adaptability underscore the need for robust cybersecurity measures and international cooperation to identify and mitigate the threats posed by such advanced persistent threat groups.
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
A Comprehensive Guide to DeFi Development Services in 2024Intelisync
DeFi represents a paradigm shift in the financial industry. Instead of relying on traditional, centralized institutions like banks, DeFi leverages blockchain technology to create a decentralized network of financial services. This means that financial transactions can occur directly between parties, without intermediaries, using smart contracts on platforms like Ethereum.
In 2024, we are witnessing an explosion of new DeFi projects and protocols, each pushing the boundaries of what’s possible in finance.
In summary, DeFi in 2024 is not just a trend; it’s a revolution that democratizes finance, enhances security and transparency, and fosters continuous innovation. As we proceed through this presentation, we'll explore the various components and services of DeFi in detail, shedding light on how they are transforming the financial landscape.
At Intelisync, we specialize in providing comprehensive DeFi development services tailored to meet the unique needs of our clients. From smart contract development to dApp creation and security audits, we ensure that your DeFi project is built with innovation, security, and scalability in mind. Trust Intelisync to guide you through the intricate landscape of decentralized finance and unlock the full potential of blockchain technology.
Ready to take your DeFi project to the next level? Partner with Intelisync for expert DeFi development services today!
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...alexjohnson7307
Predictive maintenance is a proactive approach that anticipates equipment failures before they happen. At the forefront of this innovative strategy is Artificial Intelligence (AI), which brings unprecedented precision and efficiency. AI in predictive maintenance is transforming industries by reducing downtime, minimizing costs, and enhancing productivity.
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfflufftailshop
When it comes to unit testing in the .NET ecosystem, developers have a wide range of options available. Among the most popular choices are NUnit, XUnit, and MSTest. These unit testing frameworks provide essential tools and features to help ensure the quality and reliability of code. However, understanding the differences between these frameworks is crucial for selecting the most suitable one for your projects.
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
3. Usar ou criar?
@ManagedBean
public class ProdutosBean {
@PostConstruct
public void carregaProdutos(){
ProdutoDAO produtos = new ProdutoDAO();
produtos.setConnection(ConnectionFactory.createConnection());
this.lista = dao.lista();
}
}
Thursday, September 5, 13
4. Usar!
@ManagedBean
public class ProdutosBean {
private ProdutoDAO produtos;
private ProdutosBean(ProdutoDAO produtos){
this.produtos = produtos;
}
@PostConstruct
public void carregaProdutos(){
this.lista = dao.lista();
}
}
Thursday, September 5, 13
6. Uso fácil
@ManagedBean
public class ProdutosBean {
@Inject
private ProdutoDAO produtos;
@PostConstruct
public void carregaProdutos(){
return dao.lista();
}
}
Thursday, September 5, 13
9. Outro exemplo
class ProdutoDAO{
@Inject
private EntityManager em;
public List<Produto> lista(){
return em.createQuery("select p from Produto p");
}
}
Thursday, September 5, 13
10. Criação de
EntityManager
EntityManagerFactory emf = Persistence.
createEntityManagerFactory("loja");
EntityManager em = emf.createEntityManager();
Thursday, September 5, 13
11. Tem que ensinar
class EntityManagerProducer{
private EntityManagerFactory emf =
Persistence.createEntityManagerFactory("loja");
@Produces
public EntityManager create(){
return factory.createEntityManager();
}
}
Thursday, September 5, 13
14. Qual é o remetente?
public class FinalizadorDeCompra{
private String remetente;
public void envia(){
mailer.send(remente,...);
}
}
Thursday, September 5, 13
15. Trocar a injeção de
String?
public class FinalizadorDeCompra{
@Inject
private String remetente;
public void envia(){
mailer.send(remente,...);
}
}
Thursday, September 5, 13
16. Só quero para
determinada String
public class FinalizadorDeCompra{
@Inject @RemetenteCompra
private String remetente;
public void envia(){
mailer.send(remente,...);
}
}
Thursday, September 5, 13
18. Qualifier
@ApplicationScoped
class RemetentesProducer {
@Produces
@RemetenteCompra
public String remetenteCompra(){
return properties.getProperty("remetente.compra");
}
@Produces
@RemetenteNewsletter
public String remetenteNewsletter(){
return properties.getProperty("remetente.newsletter");
}
}
Thursday, September 5, 13
19. Indo além
• VRaptor CDI e integração com o
Container
Thursday, September 5, 13
20. Injeção de coisas do
container
• Quero usar um EJB, EntityManager...
Thursday, September 5, 13
21. Injeção de coisas do
container
@Component
public class ProdutoDAO {
@Inject
private final EntityManager entityManager;
public void salva(Produto produto) {
entityManager.persist(produto);
}
Thursday, September 5, 13
22. Injeção de coisas do
container
@Stateless
@Component
public class ProdutoDAO {
@Inject
private final EntityManager entityManager;
public void salva(Produto produto) {
entityManager.persist(produto);
}
Thursday, September 5, 13
23. Injeção de coisas do
container
@Resource
public class ProdutosController {
//@EJB
@Inject
private ProdutoDAO produtoDAO;
...
}
Thursday, September 5, 13
24. EJB?
• Por sinal o DAO é um EJB porque?
Thursday, September 5, 13
25. EJB?
@Component
public class ProdutoDAO {
@Inject
private final EntityManager entityManager;
@Transactional
public void salva(Produto produto) {
entityManager.persist(produto);
}
Thursday, September 5, 13
26. Exemplo de uso
• Coloco no interceptor e tá tudo certo!
Thursday, September 5, 13
27. Componente padrão
@RequestScoped
public class DefaultPathResolver implements PathResolver {
public String pathFor(ResourceMethod method) {
String format = resolver.getAcceptFormat();
String suffix = "";
if (format != null && !format.equals("html")) {
suffix = "." + format;
}
//WEB-INF/jsp/controller/metodo.jsp
String name = method.getResource().getType().getSimpleName();
String folderName = extractControllerFromName(name);
return getPrefix() + folderName + "/" +
method.getMethod().getName() + suffix
+ "."+getExtension();
}
Thursday, September 5, 13
28. Componente
customizado
class CustomPathResolver implements PathResolver{
public String pathFor(ResourceMethod method) {
String format = resolver.getAcceptFormat();
String suffix = "";
if (format != null && !format.equals("html")) {
suffix = "." + format;
}
//WEB-INF/resources/controller/metodo.jsp
String name = method.getResource().getType().getSimpleName();
String folderName = extractControllerFromName(name);
return "WEB-INF/resources" + folderName + "/" +
method.getMethod().getName() + suffix
+ "."+getExtension();
}
}
Thursday, September 5, 13
29. Alternative
@Alternative
class CustomPathResolver implements PathResolver{
public String pathFor(ResourceMethod method) {
String format = resolver.getAcceptFormat();
String suffix = "";
if (format != null && !format.equals("html")) {
suffix = "." + format;
}
//WEB-INF/jsp/controller/metodo.jsp
String name = method.getResource().getType().getSimpleName();
String folderName = extractControllerFromName(name);
return "WEB-INF/resources" + folderName + "/" +
method.getMethod().getName() + suffix
+ "."+getExtension();
}
}
Thursday, September 5, 13
30. Registra no beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<alternatives>
<class>br.com.caelum.vraptor.view.CustomPathResolver</class>
</alternatives>
</beans>
Thursday, September 5, 13
36. Aproveita o que já
existe
public class VRaptorRequest implements
MutableRequest,HttpServletRequest {
private final Hashtable<String, String[]> extraParameters = new
Hashtable<String, String[]>();
//qual que ele vai injetar?
@Inject
private HttpServletRequest request;
}
Thursday, September 5, 13
37. Aproveitamos o
existente
@Decorator
public class VRaptorRequest implements MutableRequest,HttpServletRequest
{
@Delegate
private HttpServletRequest delegate;
@Override
public String getParameter(String name) {
if (extraParameters.containsKey(name)) {
String[] values = extraParameters.get(name);
if (values.length == 1) {
return values[0];
} else {
return Arrays.toString(values);
}
}
return delegate.getParameter(name);
}
Thursday, September 5, 13
40. Injetar Requests
public class DefaultFormatResolver implements FormatResolver {
private final HttpServletRequest request;
private final AcceptHeaderToFormat acceptHeaderToFormat;
@Inject
public DefaultFormatResolver(HttpServletRequest request,
AcceptHeaderToFormat acceptHeaderToFormat) {
this.request = request;
this.acceptHeaderToFormat = acceptHeaderToFormat;
}
public String getAcceptFormat() {
String format = request.getParameter("_format");
if (format != null) {
return format;
}
format = request.getHeader("Accept");
Thursday, September 5, 13
41. Trocar o request o
tempo todo
@Inject
private CDIHttpServletRequestFactory requestFactory;
@Inject
private CDIHttpSessionFactory sessionFactory;
public <T> T provideForRequest(RequestInfo request) {
//configurando produtores
requestFactory.setRequest(request);
sessionFactory.setSession(request);
return execution.insideRequest(container);
}
Thursday, September 5, 13
42. Notifica o povo
@Inject
private Event<HttpServletRequest> eventosDeRequest;
public <T> T provideForRequest(RequestInfo requestInfo, Execution<T>
execution) {
//configurando produtores
eventosDeRequest.fire(requestInfo.getRequest());
return execution.insideRequest(container);
}
Thursday, September 5, 13
43. Quero ser notificado
public class CDIHttpServletRequestFactory implements
ComponentFactory<HttpServletRequest>{
private HttpServletRequest request;
public void handle(@Observes HttpServletRequest request){
this.request = request;
}
public HttpServletRequest getInstance(){
return request;
}
}
Thursday, September 5, 13
46. VRaptor não usa
@Inject
@Resource
public class ProdutoDAO {
private final EntityManager entityManager;
public CDIResourceComponent(EntityManager entityManager) {
this.entityManager = entityManager;
}
}
Thursday, September 5, 13
48. Pedimos a ele para
colocar
public class AddInjectToConstructorExtension implements Extension{
public void processAnnotatedType(@Observes final ProcessAnnotatedType
pat) {
AnnotatedTypeBuilder builder = new AnnotatedTypeBuilder();
builder.readFromType(pat.getAnnotatedType());
if (hasArgsConstructorAndNoInjection) {
Constructor constructor = constructors.get(0);
//pulo do gato
builder.addToConstructor(constructor,new
AnnotationLiteral<Inject>() {});
//trocando a configuração original
pat.setAnnotatedType(builder.create());
}
}
Thursday, September 5, 13
49. VRaptor já tem
Factories
@Component
public class CDIComponent implements ComponentFactory {
private final MyRequestComponent component;
public CDIComponent(MyRequestComponent component) {
this.component = component;
}
public ComponentToBeProduced getInstance() {
return new ComponentToBeProduced();
}
}
Thursday, September 5, 13
50. Oxi, e o @Produces?
• E o @Produces?
Thursday, September 5, 13
51. @Produces em cima
do método
public class ComponentFactoryExtension implements Extension{
public void addProduces(@Observes ProcessAnnotatedType pat) {
builder.readFromType(pat.getAnnotatedType());
if (ComponentFactory.class.isAssignableFrom(javaClass)) {
builder.addToMethod(getInstance,new ProducesAnnotion());
}
}
}
class ProducesAnnotion extends AnnotationLiteral<Produces>{
}
Thursday, September 5, 13
62. Funcionalidade com
vários passos
@Controller
public class PagamentoController implements Serializable{
private InformacoesDoComprador info = new
InformacoesDoComprador();
@Inject
public PagamentoController(Result result) {
super();
this.result = result;
}
@Post("compra/endereco")
public void associaEndereco(String endereco){
info.setEnderecoDeEntrega(endereco);
}
Thursday, September 5, 13
63. Funcionalidade com
vários passos
@Controller
public class PagamentoController implements Serializable{
//resto que não coube e eu não soube ajeitar.
@Post("compra/endereco")
public void associaEndereco(String endereco){
info.setEnderecoDeEntrega(endereco);
}
@Post("compra/cartao")
public void associaCartao(String numero){
//como mantém as informações do comprador?
info.setNumeroDoCartao(numero);
result.include("dadosComprador",info);
}
}
Thursday, September 5, 13
71. E esse result?
• O Result tem que ser passivavel :(
Thursday, September 5, 13
72. Não mais :)
@Controller
@ConversationScoped
public class PagamentoController implements Serializable{
@Inject
public PagamentoController(@TransientReference Result result) {
super();
this.result = result;
}
Thursday, September 5, 13