Mcb777 Affiliate<![CDATA[Stories by Ahwin Oghenerukevwe on Medium]]> http://jeetwincasinos.com/@ahwinemman?source=rss-b9b47ff4b36f------2 http://cdn-images-1.jeetwincasinos.com/fit/c/150/150/2*tEpqmKozWzbY7A-QxSFvcw.jpeg Machibet Live<![CDATA[Stories by Ahwin Oghenerukevwe on Medium]]> http://jeetwincasinos.com/@ahwinemman?source=rss-b9b47ff4b36f------2 Medium Tue, 27 May 2025 18:52:05 GMT Machibet777 Affiliate<![CDATA[Stories by Ahwin Oghenerukevwe on Medium]]> http://jeetwincasinos.com/ahwin-oghenerukevwe/java-ee-vs-spring-injecting-properties-63dd3b04a999?source=rss-b9b47ff4b36f------2 http://jeetwincasinos.com/p/63dd3b04a999 Mon, 01 Jun 2020 03:31:45 GMT 2020-06-01T04:37:51.290Z Java EE vs Spring Boot : Injecting Properties

Theme: Comparing how properties are injected in Java EE to Spring

Prerequisites: You should be familiar with Java. A little knowledge of how things are done in the Java Web Development world would help.

Github URL: http://github.com/ahwinemman/injecting-properties

Properties file: This property file will be stored in src/main/resources folder of the respective projects.

Spring Boot

Spring boot makes it very easy to create stand-alone production-grade Spring based Applications that you can “just run" with minimum configurations.

Injecting properties in spring is as easy as annotating the respective field with the @Value(“${name_of_property}”) as seen below:

This class implements the CommandLineRunner so that the run method gets called once the application starts up so you will find the properties logged into the terminal.

To run this, you

JAVA EE

Injecting properties in Java EE coming from the Spring boot world may appear verbose irrespective it is very easy to understand.

The class below describes the typical way of getting property values using the InputStream.

The @Startup annotation ensures that this process of reading the properties file happens at the start of the application. In essence it initialises a singleton bean at startup of application.

As at Java EE 7, the @Startup annotation only applies to @Singleton beans.

The annotation below is a qualifier and it allows specify the type of property we are injecting.

To successfully inject properties in Java EE, you need the @Produces annotation which allows the injection of primitives (such as int, long, float…). You cannot also inject classes such as String or Date because these classes are packaged in the rt.jar file which is missing a beans.xml deployment descriptor file.

The @Produces annotation provides a way for us to circumvent this limitation. The Injection API does some heavy lifting for us by taking note of where the qualifier is being injected and then getting the respective property field value. Do note that the the methods below have to be annotated with both @Produces and @StringProperty annotations.

This project is built to be as similar as possible to the Spring boot project. Do note: The MainClass of the Spring boot project is very similar to the MainClass below. The classes will be initiated at application startup and much like the run method is called immediately, the @PostConstruct annotated method below will be called immediately.

To inject, we annotate the field with the @Inject as well as the qualifier @StringProperty(value = “name_of_property”)

To run any of the projects, you could simply build and then run the resulting image based of the Dockerfile included in the respective repositories

Github URL:

Do clap, comment and suggest future articles you would like me to cover if enjoyed this.


Java EE vs Spring : Injecting Properties was originally published in Ahwin Oghenerukevwe on Medium, where people are continuing the conversation by highlighting and responding to this story.

]]>
Mcb777 Affiliate<![CDATA[Stories by Ahwin Oghenerukevwe on Medium]]> http://jeetwincasinos.com/@ahwinemman/lagos-a-whole-lot-of-crazy-ff8befb26407?source=rss-b9b47ff4b36f------2 http://jeetwincasinos.com/p/ff8befb26407 Mon, 20 Jan 2020 20:58:07 GMT 2020-01-20T20:58:07.207Z LAGOS — A WHOLE LOT OF CRAZY
Photo by on 

I was born and raised up in Lagos State so I am used to the madness that happens here.

Of recent, I decided to be more present and observant of the things happening around me.

This article is short collection of some funny things I have seen.

JUST TODAY

My phone got bad so I made my way to Computer Village. I boarded a bus from Lekki Phase One to Oshodi as I usually do. On getting to Oworonshoki, I do not know who was wrong but our driver got accosted by LASTMA (The people who keep our roads in order in Lagos 😒) officials.

Next thing I knew, our driver was out and an official took his place. The normal routine is the passengers will begin to beg. We did.

What stood out was the excitement that some passengers seemed to be having, they were all JOLLY ARGUING with the LASTMA officials who later got bribed and let us go.

SAME TODAY

On my way back, I boarded a bus from Oshodi going to Ajah. The bus conductor started collecting his fare as usual. The passenger beside me started hitting the roof vexing that the conductor was too slow. I worried that he prolly had somewhere he was headed until…

A passenger who did not know the bus-stop she was going to stop at asked for directions — a good will passenger started giving her directions. The same passenger beside me in a cracked barely audible voice started getting angry at the passenger directing the lady telling him that he didn’t know how to direct somebody. At this point, I could not hold my laughter. What can I say, I am in Lagos.

MY BROTHER’S EXPERIENCE

While in a bus, a private vehicle almost ran into my brother’s bus. This is a unique situation as it’s usually the other way round. Nonetheless, there were no accidents until…

The man in the private vehicle started screaming at the bus conductor vehemently, the people in the bus were perplexed.

Next thing, the man got down. The man was in clutches. He was barely walking yet he was ready to argue with bus drivers. On seeing his state, the bus driver quickly jumped down following his conductor to beat the man.

They really beat the man, it was hard for him to defend himself until some good samaritans came to rescue him.

Putting my thoughts together, Why would a man in clutches decide to come down and fight a bus driver and his conductor??

THIS IS LAGOS.

You check statistics and you see that Lagos is one of the toughest places to live. I honestly want Lagos to be better, more organized and cleaner because it can but then would it still be Lagos?

Lagos people seem to cherish the hustle and bustle. You have people genuinely hustling and genuinely crazy.

If you have not been here, you should come around.

]]>