Enviar pesquisa
Carregar
Conhecendo CDI
•
5 gostaram
•
1,549 visualizações
Daniel Cunha
Seguir
Tecnologia
Aperfeiçoamento pessoal
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 54
Baixar agora
Baixar para ler offline
Recomendados
Sichere Web-Applikationen am Beispiel von Django
Sichere Web-Applikationen am Beispiel von Django
Markus Zapke-Gründemann
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方
Kiyotaka Oku
Quick Web Application Development using JBoss Forge
Quick Web Application Development using JBoss Forge
Daniel Cunha
OSOL CEOSUG
OSOL CEOSUG
Daniel Cunha
Conhecendo o Dtrace
Conhecendo o Dtrace
Daniel Cunha
JSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web Services
Daniel Cunha
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
prabhatthunuguntla
Joomla Day Austin Part 4
Joomla Day Austin Part 4
Kyle Ledbetter
Recomendados
Sichere Web-Applikationen am Beispiel von Django
Sichere Web-Applikationen am Beispiel von Django
Markus Zapke-Gründemann
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方
Kiyotaka Oku
Quick Web Application Development using JBoss Forge
Quick Web Application Development using JBoss Forge
Daniel Cunha
OSOL CEOSUG
OSOL CEOSUG
Daniel Cunha
Conhecendo o Dtrace
Conhecendo o Dtrace
Daniel Cunha
JSR 339 - Java API for RESTful Web Services
JSR 339 - Java API for RESTful Web Services
Daniel Cunha
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
prabhatthunuguntla
Joomla Day Austin Part 4
Joomla Day Austin Part 4
Kyle Ledbetter
Best practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on Salesforce
AIMDek Technologies
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
os890
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
Max De Marzi
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
Anton Shapin
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
Dana Luther
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
Łukasz Proszek
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
GeeksLab Odessa
Building Things Fast - and getting approval
Building Things Fast - and getting approval
Simon Willison
Testing - Selenium? Rich-Clients? Containers?
Testing - Selenium? Rich-Clients? Containers?
Tobias Schneck
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Rundeck
Sai devops - the art of being specializing generalist
Sai devops - the art of being specializing generalist
Odd-e
DevOps: The New Face Of Application Development - Global Azure Bootcamp
DevOps: The New Face Of Application Development - Global Azure Bootcamp
Richard Harbridge
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
André Goliath
Fluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdf
Roopa slideshare
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Edureka!
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Amit Chaudhary
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Teamstudio
Developing web applications in 2010
Developing web applications in 2010
Ignacio Coloma
Fastest offline with SQLite
Fastest offline with SQLite
Md. Emran Hossain Emran
Jenkins CI
Jenkins CI
haochenglee
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Roshan Dwivedi
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j
Mais conteúdo relacionado
Semelhante a Conhecendo CDI
Best practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on Salesforce
AIMDek Technologies
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
os890
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
Max De Marzi
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
Anton Shapin
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
Dana Luther
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
Łukasz Proszek
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
GeeksLab Odessa
Building Things Fast - and getting approval
Building Things Fast - and getting approval
Simon Willison
Testing - Selenium? Rich-Clients? Containers?
Testing - Selenium? Rich-Clients? Containers?
Tobias Schneck
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Rundeck
Sai devops - the art of being specializing generalist
Sai devops - the art of being specializing generalist
Odd-e
DevOps: The New Face Of Application Development - Global Azure Bootcamp
DevOps: The New Face Of Application Development - Global Azure Bootcamp
Richard Harbridge
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
André Goliath
Fluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdf
Roopa slideshare
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Edureka!
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Amit Chaudhary
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Teamstudio
Developing web applications in 2010
Developing web applications in 2010
Ignacio Coloma
Fastest offline with SQLite
Fastest offline with SQLite
Md. Emran Hossain Emran
Jenkins CI
Jenkins CI
haochenglee
Semelhante a Conhecendo CDI
(20)
Best practices for implementing CI/CD on Salesforce
Best practices for implementing CI/CD on Salesforce
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
Building Things Fast - and getting approval
Building Things Fast - and getting approval
Testing - Selenium? Rich-Clients? Containers?
Testing - Selenium? Rich-Clients? Containers?
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Keeping Your DevOps Transformation From Crushing Your Ops Capacity
Sai devops - the art of being specializing generalist
Sai devops - the art of being specializing generalist
DevOps: The New Face Of Application Development - Global Azure Bootcamp
DevOps: The New Face Of Application Development - Global Azure Bootcamp
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
Fluentlenium Functional tests hang.pdf
Fluentlenium Functional tests hang.pdf
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Salesforce Apex Hours:-Mitigate with Mono-Purpose Microservices
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Developing web applications in 2010
Developing web applications in 2010
Fastest offline with SQLite
Fastest offline with SQLite
Jenkins CI
Jenkins CI
Último
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Roshan Dwivedi
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
gurkirankumar98700
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Último
(20)
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Conhecendo CDI
1.
Conhecendo CDI CDI 1.1
- JSR 346 Daniel Cunha (soro) danielsoro@gmail.com http://www.danielsoro.com.br
2.
Daniel Cunha soro -
irc.freenode.net http://danielsoro.com.br http://github.com/danielsoro http://twitter.com/dvlc_ danielsoro@gmail.com
3.
O que é
e pra que serve o CDI?
4.
Iniciando com CDI
5.
beans.xml <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http: //xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
bean-discovery-mode="all"> </beans>
6.
Injetando suas dependências
7.
8.
@
9.
Inject
10.
E quando eu
tenho mais de uma implementação?
11.
Qualifiers
12.
Alternatives
13.
Alternatives <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http: //xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
bean-discovery-mode="all"> <alternatives> <class>package.RelaxedItemValdidator</class> </alternatives> </beans>
14.
@
15.
Priority Interceptor.Priority.PLATFORM_BEFORE = 0 Interceptor.Priority.LIBRARY_BEFORE
= 1000 Interceptor.Priority.APPLICATION = 2000 Interceptor.Priority.LIBRARY_AFTER = 3000 Interceptor.Priority.PLATFORM_AFTER = 4000
16.
E quando eu
quiser dar nome ao meu bean?
17.
@Inject @Named("user.name") private String
userName;
18.
E quando eu
quiser evoluir o meu bean?
19.
@Specializes public class ClasseFilha
extends ClasseMae {}
20.
@Specializes @Cejug public class
ClasseFilha extends ClasseMae {}
21.
@RequestScope @Ivia @Named(“mae”) public
class ClasseMae @Specializes @Cejug public class ClasseFilha extends ClasseMae {}
22.
@RequestScope @Ivia @Named(“mae”) public
class ClasseMae @Specializes @Cejug @Named(“filha”) public class ClasseFilha extends ClasseMae {}
23.
Tenho outra forma
de evitar ambiguidade?
24.
@Typed({Cejug.class,GUJavaSC.class}) public class BrazilJugs
extends Jugs {}
25.
E quando eu
quiser injetar uma classe que não é um bean CDI?
26.
import javax.enterprise.inject.Produces; public class
Produtor { @Produces public Logger criarLogger(){ return LoggerFactory.getLogger(ConhecendoCDI.class); } }
27.
E quando eu
quiser finalizar esse bean?
28.
import javax.enterprise.inject.Disposes; public class
Produtor { @Produces @CejugDB public EntityManager criaEntityManager(){ EntityManagerFactory emf = Persistence. createEntityManagerFactory("cejugdb"); return emf.createEntityManager(); } public void fechaEntityManager(@Dispose @CejugDB EntityManager em){ em.close(); } }
29.
Criações mais flexiveis
30.
import javax.enterprise.inject.Produces; public class
Produtor { @Produces public Logger criarLogger(InjectPoint injectPoint){ return LoggerFactory.getLogger(injectPoint.getMember() .getDeclaringClass().getName()); } }
31.
Escopos CDI
32.
@RequestScoped @SessionScoped @ApplicationScoped @ConversationScoped @Dependent
33.
Quero interceptar.. Como eu faço?
34.
@Interceptor @Priority(Interceptor.Priority. APPLICATION) public class
Auditor {}
35.
Posso escolher quem interceptar?
36.
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) @InterceptorBinding public @interface
Auditavel {}
37.
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) @Inherited @InterceptorBinding public @interface
Auditavel {}
38.
Interceptando o ciclo de
vida
39.
@AroundConstruct @PostConstruct @PreDestroy
40.
Decorando o nosso bean
41.
@Decorator public abstract class
CoderDecorator implements Coder { @Inject @Delegate @Any Coder coder; public String codeString(String s, int tval) { int len = s.length(); return coder.codeString(s, tval); } }
42.
Decorator <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http: //xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
bean-discovery-mode="all"> <decorators> <class>decorators.CoderDecorator</class> </decorators> </beans>
43.
Preciso replicar as
30 annotation da classe X na Y… e agora?
44.
@Stereotype
45.
import javax.enterprise.inject.Stereotype; @Stereotype @Named @RequestScoped @Auditavel
@Rastreavel @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface CejugStereotype { }
46.
Diminuindo acoplamento
47.
@Inject private Event<Palestrante> eventoCejug;
48.
eventoCejug.fire(palestrante);
49.
public void adicionarPalestrante(@Observes Palestrante
palestrante){}
50.
E eu posso
fazer chamadas assíncronas?
51.
@Asynchronous public void adicionarPalestrante(@Observes Palestrante
palestrante){}
52.
Dúvidas?
53.
Obrigado
54.
Conhecendo CDI CDI 1.1
- JSR 346 Daniel Cunha (soro) danielsoro@gmail.com http://www.danielsoro.com.br
Baixar agora