{"id":4,"date":"2015-01-25T15:40:46","date_gmt":"2015-01-25T14:40:46","guid":{"rendered":"http:\/\/itblog.inginea.eu\/?p=4"},"modified":"2016-03-11T12:04:04","modified_gmt":"2016-03-11T11:04:04","slug":"cdi-events-in-swing-application-to-decouple-ui-and-event-handling","status":"publish","type":"post","link":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/","title":{"rendered":"CDI events in Swing application to decouple UI and event handling"},"content":{"rendered":"<div id=\"post-body-3428315605292109953\" class=\"post-body entry-content\">\n<p>After having the pleasure of building my code around CDI for couple of years, it feels very natural to use it to structure my code according to well-known patterns. CDI is a dependency injection mechanism designed to be used within Java EE application servers, and this could be perceived as a disadvantage. However, I want to show that it can be used and has great potential also in a Java SE application.<\/p>\n<p>What is great about CDI is that it is much more than an injection mechanism. On top of this it provides also an elegant and powerful event passing mechanism. This feature can be nicely combined with Swing to build a GUI application based on MVC pattern.<\/p>\n<p>It is really possible to efficiently combine CDI and Swing framework to build a Java GUI application rapidly and with a clear structure.<\/p>\n<p><!--more--><\/p>\n<p>First of all, the reference implementation of CDI called Weld, is distributed also as a separate library. You may add it to your project and start using it. The only shift from the standard way of running the application is that you need to start a Weld container, which is as simple as this one liner:<\/p>\n<pre class=\"lang:java mark:4 decode:true\">import org.jboss.weld.environment.se.StartMain;\r\n...\r\n  public static void main(String[] args) {   \r\n    StartMain.main(args);\r\n  }<\/pre>\n<p>&nbsp;<\/p>\n<p>To add Weld into your maven application, just add this dependency: <a href=\"http:\/\/search.maven.org\/#artifactdetails|org.jboss.weld.se|weld-se|2.2.9.Final|jar\" target=\"_blank\">org.jboss.weld.se:weld-se:2.2.9.Final<\/a>. To execute your application code, you should put it in a method which observes ContainerInitialized event:<\/p>\n<pre class=\"lang:java decode:true\">public void start(@Observes ContainerInitialized startEvent) {\r\n  \/\/ code which would be usually in the main() method\r\n}<\/pre>\n<p>In the method above, you may initialize your application, build and display the GUI and wait for Swing events.<\/p>\n<p>And here starts the interesting part. I will use CDI event mechanism to implement binding between Swing components and the model using observer pattern. The idea is to trigger custom events whenever a data update should occur and not modify data directly. The controller observes triggered events and executes actions based on the event data. The actions then manipulate the datamodel and send notifications to the view about data updates. See following diagram:<\/p>\n<div class=\"separator\"><a href=\"https:\/\/i0.wp.com\/2.bp.blogspot.com\/-PuFbB4sHXhs\/VMQ5UIZaxZI\/AAAAAAAABs8\/dcaN9GhcPlU\/s1600\/Swing-CDI-MVC.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/2.bp.blogspot.com\/-PuFbB4sHXhs\/VMQ5UIZaxZI\/AAAAAAAABs8\/dcaN9GhcPlU\/s1600\/Swing-CDI-MVC.png?resize=640%2C441\" alt=\"\" width=\"640\" height=\"441\" border=\"0\" data-recalc-dims=\"1\" \/><\/a><\/div>\n<p>The MVC cycle starts in Swing action listeners, which compose an action object and emit it as a CDI event. The action listener is not bound to any controller code &#8211; the controller is bound to event using the CDI mechanism. This completely decouples GUI code from business logic. Following snippet responds to button click event and emits an action to add a value to a counter:<\/p>\n<\/div>\n<div class=\"post-body entry-content\">\n<pre class=\"lang:java mark:3,6 decode:true\">@ApplicationScoped\r\nclass MainFrame extends javax.swing.JFrame {\r\n  @Inject Event&lt;ChangeValueAction&gt; changeValueAction;\r\n...\r\n  void addButtonActionPerformed(java.awt.event.ActionEvent evt) {\r\n    changeValueAction.fire(ChangeValueAction.plus(getValue()));\r\n  }\r\n...\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"post-body entry-content\">\n<p>Here we need to remember that observers of CDI events would be created as new objects for any event triggered, together with all dependencies. I used <a href=\"http:\/\/docs.oracle.com\/javaee\/6\/api\/javax\/enterprise\/context\/ApplicationScoped.html\" target=\"_blank\">@ApplicationScoped<\/a> for MainFrame to ensure that all the code operates on the very same instance of it.<\/p>\n<blockquote class=\"tr_bq\"><p>One thing to mention here: in order for CDI to work, instance of MainFrame must be created by CDI, and not using its constructor directly. This is achieved by injecting it to already existing bean &#8211; e.g. the one, which observes ContainerInitialized event emitted at start-up.<\/p><\/blockquote>\n<p>CDI mechanism dispatches the event to any observer method, which listens for this type of event. We create a controller Application and put the code into an observer method, like this:<\/p>\n<pre class=\"lang:java decode:true \">public class Application {\r\n...\r\n  public void updateValueWhenChangeValueAction(@Observes final ChangeValueAction action) {\r\n  ... \/\/ controller action\r\n  }\r\n...\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Finally, the controller updates the model and triggers update of the view if necessary. If we take it further, we may trigger an update event from the controller, which would be observed by the view, in this case the MainFrame component. Or even build a model, which automatically triggers CDI events on update. Thus, controller and view would be completely decoupled and only respond to events &#8211; GUI events flowing in the direction from View to Controller, and data-update events flowing from Controller\/Model to View.In summary, CDI event mechanism is very convenient for building an MVC Swing application with View decoupled from business logic. This can be accomplished by running your application inside the Weld CDI container (1 line of code), triggering actions from Swing listeners (2 lines of code) and observing the actions (single method on any CDI-enabled class). The actions take a form of a data bean, which itself is not too many lines of code altogether.<\/p>\n<p>A complete example can be found on github: <a href=\"https:\/\/github.com\/OndrejM\/JavaDecoupledUI-CDI\">https:\/\/github.com\/OndrejM\/JavaDecoupledUI-CDI<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>After having the pleasure of building my code around CDI for couple of years, it feels very natural to use it to structure my code according to well-known patterns. CDI is a dependency injection mechanism designed to be used within Java EE application servers, and this could be perceived as a disadvantage. However, I want [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[64],"tags":[3,5,4],"series":[],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-java","tag-cdi","tag-events","tag-swing"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CDI events in Swing application to decouple UI and event handling - .Lost in Coding<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CDI events in Swing application to decouple UI and event handling - .Lost in Coding\" \/>\n<meta property=\"og:description\" content=\"After having the pleasure of building my code around CDI for couple of years, it feels very natural to use it to structure my code according to well-known patterns. CDI is a dependency injection mechanism designed to be used within Java EE application servers, and this could be perceived as a disadvantage. However, I want [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\" \/>\n<meta property=\"og:site_name\" content=\".Lost in Coding\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ondrej.mihalyi\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ondrej.mihalyi\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-25T14:40:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-11T11:04:04+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/2.bp.blogspot.com\/-PuFbB4sHXhs\/VMQ5UIZaxZI\/AAAAAAAABs8\/dcaN9GhcPlU\/s1600\/Swing-CDI-MVC.png\" \/>\n<meta name=\"author\" content=\"Ondro Mih\u00e1lyi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/OndroMih\" \/>\n<meta name=\"twitter:site\" content=\"@OndroMih\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ondro Mih\u00e1lyi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\"},\"author\":{\"name\":\"Ondro Mih\u00e1lyi\",\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"headline\":\"CDI events in Swing application to decouple UI and event handling\",\"datePublished\":\"2015-01-25T14:40:46+00:00\",\"dateModified\":\"2016-03-11T11:04:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\"},\"wordCount\":696,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"keywords\":[\"CDI\",\"events\",\"Swing\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\",\"url\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\",\"name\":\"CDI events in Swing application to decouple UI and event handling - .Lost in Coding\",\"isPartOf\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#website\"},\"datePublished\":\"2015-01-25T14:40:46+00:00\",\"dateModified\":\"2016-03-11T11:04:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ondro.inginea.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CDI events in Swing application to decouple UI and event handling\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ondro.inginea.eu\/#website\",\"url\":\"https:\/\/ondro.inginea.eu\/\",\"name\":\".Lost in Coding\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ondro.inginea.eu\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\",\"name\":\"Ondro Mih\u00e1lyi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1\",\"contentUrl\":\"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1\",\"width\":300,\"height\":300,\"caption\":\"Ondro Mih\u00e1lyi\"},\"logo\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/\"},\"description\":\"Ondro is a software developer and consultant specializing in combining standard and proven tools to solve new and challenging problems. He's been developing in Java for over 10 years. He\u2019s worked for clients like Payara, LottoLand, Uniqa and others. He has co-founded OmniFish, where he works as a director and Jakarta EE expert. He\u2019s passionate about helping his clients and the wider Java community with their projects based on Jakarta EE and similar technologies. As an experienced Java developer and instructor, he's helped companies build and educate their development teams and improve their development processes. He's a core member of several opensource projects and Jakarta EE specification projects. He\u2019s a frequent conference speaker, leader of the Czech JUG and a Java Champion. Ondro is a regular conference speaker at international conferences. Since 2016, he's presented at the following conferences: \u2022 FOSDEM, Brussels, Belgium 2023) \u2022 JChampionsConf, Online (year 2023) \u2022 EclipseCon, Germany (year 2022) \u2022 GeeCon, Prague, Czechia (years 2016, 2019, 2022) \u2022 JavaLand, Bruehl, Germany (years 2018, 2021) \u2022 JFokus, Stockholm, Sweden (year 2019) \u2022 Devops Con, Munich, Germany (year 2019) \u2022 Oracle CodeOne, San Francisco, USA (years 2018, 2019) \u2022 Devoxx, Antwerp, Belgium (year 2018) \u2022 JPrime, Sofia, Bulgaria (years 2017, 2018) \u2022 Java2Days, Sofia, Bulgaria (years 2016, 2018) \u2022 EclipseCon, France (year 2018) \u2022 JavaOne, San Francisco, USA (years 2016, 2017) \u2022 Oracle Code, Prague, Czechia (year 2017) \u2022 Devoxx, London, UK (year 2017) \u2022 GeeCon, Krakow, Poland (year 2017) \u2022 W-JAX, Munich, Germany (years 2016, 2017) \u2022 Bed-Con, Berlin, Germany (year 2017) \u2022 Oredev, Malmo, Sweden (year 2017) \u2022 Devoxx, Casablanca, Morocco (year 2017) \u2022 Java Developer Days, Krakow, Poland (year 2016)\",\"sameAs\":[\"https:\/\/www.facebook.com\/ondrej.mihalyi\",\"https:\/\/cz.linkedin.com\/in\/mihalyiondrej\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/OndroMih\"],\"url\":\"https:\/\/ondro.inginea.eu\/index.php\/author\/ondrejm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CDI events in Swing application to decouple UI and event handling - .Lost in Coding","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/","og_locale":"en_US","og_type":"article","og_title":"CDI events in Swing application to decouple UI and event handling - .Lost in Coding","og_description":"After having the pleasure of building my code around CDI for couple of years, it feels very natural to use it to structure my code according to well-known patterns. CDI is a dependency injection mechanism designed to be used within Java EE application servers, and this could be perceived as a disadvantage. However, I want [&hellip;]","og_url":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/","og_site_name":".Lost in Coding","article_publisher":"https:\/\/www.facebook.com\/ondrej.mihalyi","article_author":"https:\/\/www.facebook.com\/ondrej.mihalyi","article_published_time":"2015-01-25T14:40:46+00:00","article_modified_time":"2016-03-11T11:04:04+00:00","og_image":[{"url":"http:\/\/2.bp.blogspot.com\/-PuFbB4sHXhs\/VMQ5UIZaxZI\/AAAAAAAABs8\/dcaN9GhcPlU\/s1600\/Swing-CDI-MVC.png"}],"author":"Ondro Mih\u00e1lyi","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/OndroMih","twitter_site":"@OndroMih","twitter_misc":{"Written by":"Ondro Mih\u00e1lyi","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#article","isPartOf":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/"},"author":{"name":"Ondro Mih\u00e1lyi","@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"headline":"CDI events in Swing application to decouple UI and event handling","datePublished":"2015-01-25T14:40:46+00:00","dateModified":"2016-03-11T11:04:04+00:00","mainEntityOfPage":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/"},"wordCount":696,"commentCount":0,"publisher":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"keywords":["CDI","events","Swing"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/","url":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/","name":"CDI events in Swing application to decouple UI and event handling - .Lost in Coding","isPartOf":{"@id":"https:\/\/ondro.inginea.eu\/#website"},"datePublished":"2015-01-25T14:40:46+00:00","dateModified":"2016-03-11T11:04:04+00:00","breadcrumb":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ondro.inginea.eu\/index.php\/cdi-events-in-swing-application-to-decouple-ui-and-event-handling\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ondro.inginea.eu\/"},{"@type":"ListItem","position":2,"name":"CDI events in Swing application to decouple UI and event handling"}]},{"@type":"WebSite","@id":"https:\/\/ondro.inginea.eu\/#website","url":"https:\/\/ondro.inginea.eu\/","name":".Lost in Coding","description":"","publisher":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ondro.inginea.eu\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616","name":"Ondro Mih\u00e1lyi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/","url":"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1","contentUrl":"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1","width":300,"height":300,"caption":"Ondro Mih\u00e1lyi"},"logo":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/"},"description":"Ondro is a software developer and consultant specializing in combining standard and proven tools to solve new and challenging problems. He's been developing in Java for over 10 years. He\u2019s worked for clients like Payara, LottoLand, Uniqa and others. He has co-founded OmniFish, where he works as a director and Jakarta EE expert. He\u2019s passionate about helping his clients and the wider Java community with their projects based on Jakarta EE and similar technologies. As an experienced Java developer and instructor, he's helped companies build and educate their development teams and improve their development processes. He's a core member of several opensource projects and Jakarta EE specification projects. He\u2019s a frequent conference speaker, leader of the Czech JUG and a Java Champion. Ondro is a regular conference speaker at international conferences. Since 2016, he's presented at the following conferences: \u2022 FOSDEM, Brussels, Belgium 2023) \u2022 JChampionsConf, Online (year 2023) \u2022 EclipseCon, Germany (year 2022) \u2022 GeeCon, Prague, Czechia (years 2016, 2019, 2022) \u2022 JavaLand, Bruehl, Germany (years 2018, 2021) \u2022 JFokus, Stockholm, Sweden (year 2019) \u2022 Devops Con, Munich, Germany (year 2019) \u2022 Oracle CodeOne, San Francisco, USA (years 2018, 2019) \u2022 Devoxx, Antwerp, Belgium (year 2018) \u2022 JPrime, Sofia, Bulgaria (years 2017, 2018) \u2022 Java2Days, Sofia, Bulgaria (years 2016, 2018) \u2022 EclipseCon, France (year 2018) \u2022 JavaOne, San Francisco, USA (years 2016, 2017) \u2022 Oracle Code, Prague, Czechia (year 2017) \u2022 Devoxx, London, UK (year 2017) \u2022 GeeCon, Krakow, Poland (year 2017) \u2022 W-JAX, Munich, Germany (years 2016, 2017) \u2022 Bed-Con, Berlin, Germany (year 2017) \u2022 Oredev, Malmo, Sweden (year 2017) \u2022 Devoxx, Casablanca, Morocco (year 2017) \u2022 Java Developer Days, Krakow, Poland (year 2016)","sameAs":["https:\/\/www.facebook.com\/ondrej.mihalyi","https:\/\/cz.linkedin.com\/in\/mihalyiondrej","https:\/\/twitter.com\/https:\/\/twitter.com\/OndroMih"],"url":"https:\/\/ondro.inginea.eu\/index.php\/author\/ondrejm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6wlb6-4","jetpack-related-posts":[{"id":910,"url":"https:\/\/ondro.inginea.eu\/index.php\/portable-cdi-injection-into-jax-rs-sub-resources\/","url_meta":{"origin":4,"position":0},"title":"How to properly inject CDI beans into JAX-RS sub-resources","author":"Ondro Mih\u00e1lyi","date":"26 October, 2021","format":false,"excerpt":"Jakarta REST (JAX-RS) defines it's own dependency injection using the @Context annotation. REST resources also support CDI injection if you enable CDI on the REST resource class (e.g. using a bean-defining annotation like @RequestScoped). But injection doesn't work out of the box on JAX-RS sub-resources. How to create sub-resources so\u2026","rel":"","context":"In &quot;REST&quot;","block_context":{"text":"REST","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/jakarta-ee\/ee-rest\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":209,"url":"https:\/\/ondro.inginea.eu\/index.php\/mvc-1-0-in-java-ee-8-getting-started-using-facelets\/","url_meta":{"origin":4,"position":1},"title":"MVC 1.0 in Java EE 8: Getting started using facelets","author":"Ondro Mih\u00e1lyi","date":"19 January, 2016","format":false,"excerpt":"MVC 1.0 is an action-based Model-View-Controller web framework, which will be a part of future Java EE 8. It will live side by side with component-based JSF framework and will provide an alternative for building HTML+javascript oriented applications with full control over URLs. This post summarizes what needs to be\u2026","rel":"","context":"In &quot;Jakarta EE&quot;","block_context":{"text":"Jakarta EE","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/jakarta-ee\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":931,"url":"https:\/\/ondro.inginea.eu\/index.php\/get-user-info-in-jakarta-ee\/","url_meta":{"origin":4,"position":2},"title":"Get logged-in user info in Jakarta EE &#8211; the simplest way","author":"Ondro Mih\u00e1lyi","date":"13 November, 2021","format":false,"excerpt":"The security before Java EE 8 \/ Jakarta EE 8 used to be a bit complicated and confusing. Every specification provided its own way to retrieve information about the logged-in user. The situation greatly improved with the introduction of the Security API that provides a unified way to do that\u2026","rel":"","context":"In &quot;Security&quot;","block_context":{"text":"Security","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/jakarta-ee\/ee-security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":806,"url":"https:\/\/ondro.inginea.eu\/index.php\/possible-ways-to-use-arquillian-in-jakarta-ee-tcks\/","url_meta":{"origin":4,"position":3},"title":"Possible ways to use Arquillian in Jakarta EE TCKs","author":"Ondro Mih\u00e1lyi","date":"12 April, 2020","format":false,"excerpt":"Recently, we had a discussion how to create a standalone Jakarta Batch test kit (TCK). For most of the committers, it's pretty natural to use Arquillian to abstracts tests away from how they are executed on an implementation. But Romain proposed an intriguing idea to use plain JUnit5 that got\u2026","rel":"","context":"In &quot;Jakarta EE&quot;","block_context":{"text":"Jakarta EE","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/jakarta-ee\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":157,"url":"https:\/\/ondro.inginea.eu\/index.php\/structure-of-modern-java-ee-application-in-slovak-language\/","url_meta":{"origin":4,"position":4},"title":"[Slovak language] \u0160trukt\u00fara modernej Java EE aplik\u00e1cie","author":"Ondro Mih\u00e1lyi","date":"4 October, 2015","format":false,"excerpt":"Read in Slovak language: \u0160trukt\u00fara modernej Java EE aplik\u00e1cie (Structure of modern Java EE application). \u00a0","rel":"","context":"In &quot;Slovak&quot;","block_context":{"text":"Slovak","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/slovak\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":533,"url":"https:\/\/ondro.inginea.eu\/index.php\/using-hotswapagent-to-speed-up-development\/","url_meta":{"origin":4,"position":5},"title":"Using HotswapAgent to speed up development","author":"Ondro Mih\u00e1lyi","date":"20 October, 2017","format":false,"excerpt":"As a Java EE developer, I sometimes envy how fast it's possible to see the result of a code change in a running application with interpreted languages like PHP or JavaScript. With Java, it's always necessary to rebuild the source code in a bytecode, which can be then safely updated\u2026","rel":"","context":"In &quot;Configuration&quot;","block_context":{"text":"Configuration","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/config\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/09\/Screenshot-from-DCEVM.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/comments?post=4"}],"version-history":[{"count":13,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":302,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/4\/revisions\/302"}],"wp:attachment":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/media?parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/categories?post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/tags?post=4"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/series?post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}