<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SPRINGFRAMEWORK on Flowing Code</title><link>https://www.flowingcode.com/en/category/springframework/</link><description>Recent content in SPRINGFRAMEWORK on Flowing Code</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 07 May 2020 14:00:29 +0000</lastBuildDate><atom:link href="https://www.flowingcode.com/en/category/springframework/index.xml" rel="self" type="application/rss+xml"/><item><title>Vaadin 10 + Spring Demo application: World Cup Rusia 2018 stats</title><link>https://www.flowingcode.com/en/vaadin-10-spring-demo-application-world-cup-rusia-2018-stats/</link><pubDate>Tue, 03 Jul 2018 16:36:00 +0000</pubDate><guid>https://www.flowingcode.com/en/vaadin-10-spring-demo-application-world-cup-rusia-2018-stats/</guid><description>&lt;div style="clear: both; text-align: center;">&lt;img alt="" class="alignnone size-full wp-image-430" height="340" loading="lazy" src="https://www.flowingcode.com/images/uploads/2018/07/Vaadin-10-Spring-Demo-application_-World-Cup-Rusia-2018-stats-1.png" width="760"/>&lt;/div>
&lt;div>
&lt;div>&lt;/div>
&lt;div style="text-align: justify;">To test out some new interesting web technologies, we decided to go ahead and build a small demo application that will point out ideas that could potentially help a developer when trying to decide which ones to use in a new project. We decided to create a small application with responsiveness in mind, that would show real time and aggregated data about the current Football World Cup event that is taking place in Russia.&lt;/div>
&lt;/div>
&lt;h4>Technologies&lt;/h4>
&lt;div>The chosen technologies where:&lt;/div>
&lt;div>
&lt;ul>
&lt;li style="text-align: justify;">&lt;a href="https://vaadin.com/" rel="noopener noreferrer" target="_blank">Vaadin 10&lt;/a>: The brand new version of the popular framework, that is powered by the new standards being pushed by the most popular browsers.&lt;/li>
&lt;li style="text-align: justify;">&lt;a href="https://spring.io/" rel="noopener noreferrer" target="_blank">SpringFramework&lt;/a>: The almost de-facto standard dependency injection framework, that stands as the backbone of almost every java project that are currently being built.&lt;/li>
&lt;li style="text-align: justify;">REST API: Our project uses the API available &lt;a href="http://worldcup.sfg.io/" rel="noopener noreferrer" target="_blank">here&lt;/a>. That API exposes data as a REST API with information being delivered in JSON format.&lt;/li>
&lt;/ul>
&lt;/div>
&lt;h4>Features&lt;/h4>
&lt;div>This is a short list of currently supported features:&lt;/div>
&lt;div>
&lt;ul>
&lt;li style="text-align: justify;">The application is responsive, it will correctly display information regardless the device being used. This feature is achieved by using Vaadin &amp;amp; Polymer technologies.&lt;/li>
&lt;li style="text-align: justify;">Depending on the device that you’re browsing the site (especially mobile phones), you can add the application to the home screen, so it will look like a native application. The only catch is that it will not function in offline mode (yet, maybe sooner).&lt;/li>
&lt;li style="text-align: justify;">You can follow the matches in realtime. Using WebSockets, the application maintains an opened communication pipe between the browser and the server, so the updates can be informed to the client as soon as they are received from the API&lt;/li>
&lt;/ul>
&lt;h4>Construction&lt;/h4>
&lt;div style="text-align: justify;">You need to have a good starting point to start any new project. For us it was the &lt;a href="https://vaadin.com/start/v10-project-base-spring" rel="noopener noreferrer" target="_blank">Vaadin Base Project with String&lt;/a> starter. By choosing this option, we could benefit of the fact that it already has a tested and working Spring configuration, so it was an easy decision.&lt;/div>
&lt;h4>Responsiveness&lt;/h4>
&lt;div>
&lt;div style="text-align: justify;">We achieved this goal, by starting also a parallel development: &lt;a href="https://vaadin.com/directory/component/app-layout-addon" rel="noopener noreferrer" target="_blank">a new Addon for the Vaadin platform&lt;/a> that helps you to build new applications using a simple skeleton that takes care of building the usual visual elements present in a responsive application: hamburger menu, paper-cards and more.&lt;/div>
&lt;/div>
&lt;div>
&lt;div style="text-align: justify;">Besides that, we also used some CSS techniques as media queries to make the final touches.&lt;/div>
&lt;/div>
&lt;h4>PWA&lt;/h4>
&lt;div>
&lt;div style="text-align: justify;">To allow the application to be added to the home screen of your device, and then showing it as a native application, we generated a PWA manifest, with some properties that you can easily mimic, by using a tool like the &lt;a href="https://app-manifest.firebaseapp.com/" rel="noopener noreferrer" target="_blank">App Manifest Generator&lt;/a>.&lt;/div>
&lt;/div>
&lt;h4>Realtime updates&lt;/h4>
&lt;/div>
&lt;div style="clear: both; text-align: center;">&lt;/div>
&lt;div>
&lt;div style="text-align: justify;">This feature is really easy to implement, given Vaadin’s @Push tecnology, based on websockets. Just adding a simple annotation to your main layout will give life to your bubbling screen.&lt;/div>
&lt;div style="text-align: justify;">You can learn more about this technology in &lt;a href="https://vaadin.com/docs/v10/flow/advanced/tutorial-push-configuration.html" rel="noopener noreferrer" target="_blank">Vaadin’s official documentation&lt;/a>.&lt;/div>
&lt;h4>Roadmap&lt;/h4>
&lt;p>These are the things we would like to implement in the near future:&lt;/p></description></item><item><title>ComboBox lazy loading with REST API in Vaadin 8</title><link>https://www.flowingcode.com/en/combobox-lazy-loading-with-rest-api-in-vaadin-8/</link><pubDate>Mon, 09 Apr 2018 13:55:00 +0000</pubDate><guid>https://www.flowingcode.com/en/combobox-lazy-loading-with-rest-api-in-vaadin-8/</guid><description>&lt;div style="background-color: white; color: #172b4d; letter-spacing: -0.07px; margin-top: 12px; padding: 0px; word-wrap: break-word;">
&lt;div style="letter-spacing: -0.07px; margin-top: 12px; padding: 0px; word-wrap: break-word;">
&lt;div style="letter-spacing: -0.07px; margin-top: 12px; padding: 0px; word-wrap: break-word;">
&lt;div style="clear: both; font-size: 14px; text-align: center;">&lt;img alt="" class="alignnone size-full wp-image-434" height="340" loading="lazy" src="https://www.flowingcode.com/images/uploads/2018/04/ComboBox-lazy-loading-with-REST-API-in-Vaadin-8.png" width="760"/>&lt;/div>
&lt;div>&lt;/div>
&lt;div style="text-align: justify;">&lt;span style="font-family: inherit;">In this post we’ll explore how to access a REST service in order to display items in a ComboBox in Vaadin 8.&lt;/span>&lt;/div>
&lt;/div>
&lt;div style="letter-spacing: -0.07px; margin-top: 12px; padding: 0px; word-wrap: break-word;">
&lt;div style="text-align: justify;">&lt;span style="font-family: inherit;">First, we’ll implement a REST service with Spring Boot, as described &lt;a href="https://spring.io/guides/gs/rest-service" rel="nofollow" style="color: #0052cc; text-decoration-line: none;">here&lt;/a>&lt;/span>&lt;/div>
&lt;/div>
&lt;div style="letter-spacing: -0.07px; margin-top: 12px; padding: 0px; word-wrap: break-word;">
&lt;div style="text-align: justify;">&lt;span style="font-family: inherit;">The web service will be exposed at &lt;a href="http://127.0.0.1:8081/api/countries" rel="nofollow" style="color: #0052cc;">http://127.0.0.1:8081/api/countries&lt;/a>. It will receive no parameters and return an array containing the name of all the countries known by the JVM (the Geography knowledge of the JVM is amazing!).&lt;/span>&lt;/div>
&lt;div style="font-size: 14px;">&lt;/div>
&lt;/div>
&lt;div style="font-size: 14px; letter-spacing: -0.07px; margin: 10px 0px 0px; padding: 0px;">
&lt;pre>&lt;code class="nohighlight">@RestController
public class CountriesController {
&lt;pre>&lt;code>@RequestMapping(&amp;quot;/api/countries&amp;quot;)
public String[] getCountries() {
 return countries().toArray(String[]::new);
} 

private static Stream&amp;amp;lt;String&amp;amp;gt; getCountries() {
 return Stream.of(Locale.getISOCountries())
 .map(countryCode -&amp;amp;gt; new Locale(&amp;quot;&amp;quot;, countryCode))
 .map(locale-&amp;amp;gt;locale.getDisplayCountry(Locale.ENGLISH))
 .sorted();
}
&lt;/code>&lt;/pre>
&lt;p>}&lt;/code>&lt;/pre>&lt;/p></description></item><item><title>Implementing Spring Security on a Vaadin application</title><link>https://www.flowingcode.com/en/implementing-spring-security-on-a-vaadin-application/</link><pubDate>Mon, 30 Oct 2017 15:35:00 +0000</pubDate><guid>https://www.flowingcode.com/en/implementing-spring-security-on-a-vaadin-application/</guid><description>&lt;div style="clear: both; text-align: center;">&lt;img alt="" class="alignnone size-full wp-image-440" height="340" loading="lazy" src="https://www.flowingcode.com/images/uploads/2017/10/Implementing-Spring-Security-on-a-Vaadin-application.png" width="760"/>&lt;/div>
&lt;p>Today I’m going to write a little bit about my experience of trying to secure a simple Vaadin application using one of the most popular security frameworks: the security extensions of SpringFramework.&lt;br/>
This post will cover the part of configuring a default setting to make it work, of course after this, there are a lot of things to do in your project to finish implementing this, such as storing and retrieving your user details from the underlying datastore of your choice, choosing the password-hashing algorithm, and so on. But at least you will have an overview of what needs to be done to accomplish this.&lt;/p></description></item></channel></rss>