Rust: starting with blazingly fast programming language

 How I heard about Rust. As a regular user/contributor of one of popular tech forum stack overflow , I read almost all the blog post on stack-overflow. Every year they hold programming survey and Rust is on top since last 4-5 years. you can read about this survey here . First look: As a curious user, I tried to take a look at the language website , which talks about why Rust and many other things. First question came to my mind was, why another language?  what are we trying to solve? there are many other languages out there along with popular frameworks and thriving developer communities .  I come from Java development background and have been building web-apps since 2012. So the first statement that caught my attention, is that its blazingly fast . What is it that makes Rust so fast? Static typing:  Its statically typed language. So Rust compiler knows

Advanced wiring in Spring Part-2

In the last article we have seen that how we can configure beans based on certain environments.This is quite useful features spring have provided.Sometimes we need more granular control over the bean autowiring in spring, such as we need certain beans that needs to be autowired or injected on some complex condition (which is something more than certain environment). for e.g. What if we need certain bean needs to be injected if some other bean have specific property value. or inject an bean only if some other class is found on class-path. Here Spring will help you to make such a configuration using @Conditional annotation. Suppose we want the bean OperationUser to be created if the property " department= Operations " is set in your properties file. @Bean @Conditional(OpsDepartmentCondition.class) public OperationsUser operationsUser(){ OpeartionsUser opsUser = new OperationsUser(); return opsUser; } We will take a look at how OpsDepartmentCondition will

Advanced wiring in Spring

Many times we face situation in which we want certain things configured as per the environment or on certain complex condition. Spring provides great features in easing the developer job for this use-case. We will look at such a scenario along with solution spring provides in this case. Environments and Profiles: One of the most challenging part of any application is to transitioning of the software into different environments (DEV, QA, STG, PROD). Certain choices that we make in DEV environments are not suitable when we run the same setup on PROD environment. Consider basic use of using different database as per the deployment environment. for DEV we might setup a datasource something like below: @Bean(destroyMethod = "shutdown") public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .addScript("classpath:devCreate.sql") .addScript("classpath:devInsert.sql") .build(); } but when we will go on PROD environment, this c

Docker fundamentals

Nowadays everybody is talking about Docker. Some people are well versed with docker concepts and have hands on it and some have started learning docker. So what is Docker?. As per the official docs from docker, Docker is a platform for developers and sysadmins to develop , deploy , and run applications with containers. So what does make it different. We were already doing that since long . When we are deploying application on servers we have to deal with setting up new VM , configuring dependencies / libraries, environment variables. Docker makes this thing easy for you, by providing OS level virtualization (aka. containerization). So basically you can create Docker images that will have all your resources ( env. variables / libs / running on what port). Then you can deploy your application inside docker container anywhere without even worrying about the dependencies. In traditional way you have to setup separate VM and then install all the required software and have

Spring RestTemplate : Follow Redirect Automatically

Follow Redirect Automatically in Spring RestTemplate.... Now since the boost of micro-service based architecture we use web-services a lot. Spring boot is one of the popular framework to work on Micro-service based architecture. Soap web-services are legacy swords and REST( Representational State transfer ) is now the modern time weapon in everybody's arsenal. When we use REST with Spring we have lot of inbuilt functionalities (Converting Response and request to Domain objects, Error handling, HttpStatus code and many more...) offered by Spring. Today we are going to check about RestTemplate. Spring's central class for synchronous client-side HTTP access. This is what Spring says about RestTemplate. RestTemplate provides support to all HTTP Methods. Most popular are GET and POST. So when we are calling any webservice endpoint using RestTemplate GET or POST there are chances that in response you get Redirect response (302 HTTP Status code). Which indicates that this

JShell : Test your logic right away

You might have heard about Java version 9 release and lot of buzzwords related to the new features that are going to unleashed from Oracle. New Module system(jigsaw) , Jlink and more tools are introduced. Today we will talk about one of the tool(aka. feature) which provides functionality that you might have used when you have used javascript and other languages... So, What it is .... REPL (Read-Evaluate-Print-Loop). So as you know, when you are writing software all these years, and at any point of time if you want to just execute some random code, some logic that you think it can work, you go to the command line shell (any shell that helps you to execute that language commands) and just right it there and execute..that's it.. Just check out the below features from your browser tools console executing javascript code (REPL feature). Python, Ruby, Haskell, Tcl also have  REPL features. Unfortunately java was lacking REPL feature from long time..and with the release o

Solve Illegal key size or default parameters

Solve Illegal key size or default parameters When first time I was working on AES 256 bit encyrption, I faced above exception. I tried everything and was frustrated what is the main cause. Then I reasearhed little bit on this, and found this has to do with " Java Cryptography Extension (JCE) Unlimited Strength Policy Files" . So, What is  JCE Unlimited Strength Policy ? So when you install JDK / JRE on your machine a normal version of JCE policy jars is included which doesn't support higher bit (256 in my case) encryption / decryption. The reason behind this is, US has restrictions on the export of cryptographic technology: They used to be very strict -- cryptography was classified as munitions, and you can only download the full strength products from the US and other white-listed countries. Restrictions have eased up a lot since then,