Spring Boot: Listening for incoming emails in your application

There are several options how to process incoming emails in our applications. We can for example route email into standard mailbox and periodically download emails into our application with POP3 protocol. Or we can run our own SMTP server inside Spring Boot application. And this is the case! Adding Spring Boot project dependency I prefer using Gradle for all my Spring Boot projects so adding dependency means adding one line into build.gradle file in my project directory. SubethaSMTP is library that contains embeddable SMTP server implementation, great option for our purpose. compile ("org.subethamail:subethasmtp:3.1.7") Starting SMTP server when Spring Boot starts

Spring Boot: Login Listener

There are many situations when we are required to listen for successful login event. To store last login information, to manage some post login account handling … it’s quite easy to do by following Spring Boot way. Spring Boot internals gather application listener beans (we must inherit ApplicationListener<InteractiveAuthenticationSuccessEvent> here and annotate as @Component) during startup. Such simple bean and configuration (see code below) causes Spring Boot to call my listener and provide me with authenticated user’s details. And this is what I just needed! This little post is just a reminder for me, that such a listener is invoked for form authentication only and doesn’t run when basic authentication enabled.

Spring Boot: Active Directory authentication

Spring Boot offers a wide range of authentication options through Spring Security module. We usually use custom authentication code that finds username/password in database (preferring MongoDB) and do proper authentication. In some cases, based on company accounts handling culture, there is a request to authenticate users based on existing Active Directory accounts. When digging around this one can find, that it’s quite easy to do in Spring Boot with Spring Security module. To accomplish Active Directory based authentication, we should simply create a @Configuration bean that is going to be scanned and loaded during a Spring Boot application start (the following assume we have initial Spring Boot project created and Spring Security Starter referenced as Maven or Gradle dependency).

Spring Boot 1.4.x & Thymeleaf 3.x configuration

Thymeleaf is quite popular template engine widely used among Spring Boot developers. And we use it as well. While working with Spring Boot 1.4.x you will find that spring-boot-starter-thymeleaf is based on older Thymeleaf 2.x version, while there is Thymeleaf 3.x available for some time. But wait, there is an easy way how to get latest Thymeleaf for my Spring Boot 1.4.x application. There are 3 simple steps to do so. Reference Thymeleaf in build.gradle file (assuming we have Gradle based Spring Boot project) compile("org.springframework.boot:spring-boot-starter-thymeleaf") compile ("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.0.RELEASE") compile ("io.github.jpenren:thymeleaf-spring-data-dialect:3.1.1") Specify Thymeleaf version in build.gradle file Here is the place to say that we want version 3.

Vaadin 8 in Kotlin: Binding data

Binding from data bean to UI components is very common Vaadin feature. Vaadin 8 changes the API slightly and simplifies this operation. Each item below references code comment number in code snippet below. BeanBinder — bean binder is object that holds the state and organize validation and data conversions. Binding fields — each field can be bound individually. We do binding from Vaadin UI component (e.g. TextField). Binding includes validators and possible data convertors. Binding all fields — besides individual bean bindings we can bind entire bean to UI components with binder.bindInstanceFields(this) . We can even combine individual field bindings with validator definitions and then we bind rest of the bean fields that don’t require any special handling.

Vaadin 8 in Kotlin: Data model changes — ComboBox, Grid …

There are many nice features promised to come with Vaadin version 8. You probably know that Vaadin 8 is JDK 1.8 optimized version and many related simplifications are available in API now. Let’s look at some nice features related to data model closely. All examples below are created using Kotlin syntax. ComboBox Items Data source for ComboBox can be defined as a simple list of beans using setItems methods. Caption for ComboBox items displayed in a browser can be defined as generator using setItemCaptionGenerator method. It’s a real simplification as we can define a lambda for caption computation from bean properties.

ChatBot – interaktivní možnosti komunikace s IS - 2. cast

V předchozím díle jsme nastínili možnosti použití chatbotů v rámci vnitrofiremních řešení. Chatboti mohou být jakousi vstupní branou, přes kterou se mohou vybraní uživatelé dostat k informacím z firemních informačních systémů(IS) . (využití chatbotů nabízí plejádu možností. O některých zajímavých řešení se můžete dočíst například zde. ) Komunikace s chatbotem nemusí být pouze v textové podobě, ale můžeme uživatelům mnohé věci ulehčit. Například v rámci bezpečného chatovacího systému Telegram máme možnost využít některé zjednodušující komunikační prvky. v rámci chatovací komunikace můžeme uživateli zobrazit tlačítka, která slouží jako prostředek pro vyjádření uživatelovi volby nebo odpovědi. Osoba tak nemusí nic ručně vypisovat, ale jednu z nabízených voleb pouze odklikne.

ChatBot – interaktivní možnosti komunikace s IS - 1. cast

Používání ‚chatu‘ pro vzájemnou on-line komunikaci je již dlouhá léta běžnou záležitostí. Provozovatelé těchto služeb však vlastnosti svých nástrojů rozšiřují o možnosti tvorby automatických odpovědních automatů tzn. ‚chatbotů‚. Jejich využití je možné v mnoha oblastech mezi které můžeme zařadit i vnitrofiremní informační systémy(IS) typu CRM, DMS apod. Samotný chatovací klient se tak může stát klientem(alternativním uživatelským rozhraním) pro náš IS. Obdobně tak jako uživatelé komunikují prostřednictvím chatu vzájemně, mohou komunikovat se svým IS, který je reprezentován tzn. ‚chatbotem‚. Ten tvoří komunikační rozhraní, prostřednictvím něhož můžeme nabízet různé datové služby. Možnosti použití: vytahování informací z IS (dotaz na kontakty, moje úkoly) tvorba nových záznamů v IS typu úkol, aktivita, kontaktní adresa apod.