<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Lamb</title>
    <description>The latest articles on DEV Community by Michael Lamb (@themichaellamb).</description>
    <link>https://dev.to/themichaellamb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F144409%2F210e0a01-8802-49e9-89aa-3f576cd228ed.jpg</url>
      <title>DEV Community: Michael Lamb</title>
      <link>https://dev.to/themichaellamb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/themichaellamb"/>
    <language>en</language>
    <item>
      <title>[Redis Hackathon Submission Post Placeholder Title]</title>
      <dc:creator>Michael Lamb</dc:creator>
      <pubDate>Tue, 23 Aug 2022 12:29:53 +0000</pubDate>
      <link>https://dev.to/themichaellamb/redis-hackathon-submission-post-placeholder-title-2bc0</link>
      <guid>https://dev.to/themichaellamb/redis-hackathon-submission-post-placeholder-title-2bc0</guid>
      <description>&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;h3&gt;
  
  
  [Optional: Video Explainer of My Project]
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;

&lt;p&gt;BTW, your Github code’s README file should contain the details as &lt;a href="https://github.com/redis-developer/hackathon-docs/blob/main/README.md"&gt;per this template&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;[Note:] # (Be sure to link to any open source projects that are using your workflow!)&lt;/p&gt;

&lt;p&gt;[Note:] # Screenshots/demo videos are encouraged!&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;[Reminder]: # (Submissions are due on August 29th, 2022 @ 11:59 PM UTC).&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
    </item>
    <item>
      <title>Spring Framework - Dependency Injection</title>
      <dc:creator>Michael Lamb</dc:creator>
      <pubDate>Thu, 27 Feb 2020 07:04:44 +0000</pubDate>
      <link>https://dev.to/themichaellamb/spring-framework-dependency-injection-3e8o</link>
      <guid>https://dev.to/themichaellamb/spring-framework-dependency-injection-3e8o</guid>
      <description>&lt;p&gt;The Spring Framework empowers developers to create Java applications and deliver on business focus quickly. The primary benefit of Spring is its inversion-of-control container approach to dependency injection, removing the need for hard-coded wiring as the framework can inject dependencies where they are needed. &lt;/p&gt;

&lt;h1&gt;
  
  
  Benefits
&lt;/h1&gt;

&lt;p&gt;• Testability&lt;br&gt;
• Maintainability&lt;br&gt;
• Scalability&lt;/p&gt;
&lt;h2&gt;
  
  
  Testability
&lt;/h2&gt;

&lt;p&gt;Because Spring decouples object contracts from their implementations and autowires them using Spring's Application Context, we can create units of work that are much easier to write tests for. &lt;/p&gt;
&lt;h2&gt;
  
  
  Maintainability
&lt;/h2&gt;

&lt;p&gt;By using Spring's opinionated architecture, developers can quickly identify and familiarize themselves with an application's business focus. Most frameworks are popular because they operate on some fundamentals that are easy to grasp, which is one of Spring's strengths.&lt;/p&gt;
&lt;h2&gt;
  
  
  Scalability
&lt;/h2&gt;

&lt;p&gt;Spring containers utilizing Spring Boot are able to deploy as standalone JARs and run on an included Tomcat server. Between Spring's &lt;code&gt;@Profile&lt;/code&gt; annotations and the Spring Application Context Configuration, there is a lot of flexibility to control the behavior of a Spring application in varying environments. &lt;/p&gt;
&lt;h1&gt;
  
  
  IoC/Dependency Injection in Spring
&lt;/h1&gt;

&lt;p&gt;Understanding dependency injection is a fundamental component of understanding the Spring Framework. &lt;a href="https://spring.io/projects/spring-boot"&gt;Spring Boot&lt;/a&gt; is the most popular project developers get started with and is an excellent sandbox for development ideas around dependency injection. Let's take a look, getting started with how we can store configurations in a Java class and tell Spring how to use it with the &lt;code&gt;@Configuration&lt;/code&gt; annotation.&lt;/p&gt;
&lt;h2&gt;
  
  
  ApplicationContextConfiguration
&lt;/h2&gt;

&lt;p&gt;Using the &lt;code&gt;@Configuration&lt;/code&gt; annotation enables Java configuration of specific dependencies. In the example below, we will tell Spring what implements the&lt;code&gt;UserDao&lt;/code&gt; and what &lt;code&gt;DataSource&lt;/code&gt; to build. We are assuming the &lt;code&gt;UserDao&lt;/code&gt; uses constructor injection to determine its database connection dependency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.Bean&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.Configuration&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nd"&gt;@Configuration&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApplicationContextConfiguration&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// (1)&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="nd"&gt;@Bean&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="nf"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// (2)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="nc"&gt;MysqlDataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MysqlDataSource&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setUser&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setPassword&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"s3cr3t"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setURL&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"jdbc:mysql://localhost:3306/myDatabase"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="nd"&gt;@Bean&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;UserDao&lt;/span&gt; &lt;span class="nf"&gt;userDao&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// (3)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserDao&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;The class name used with a &lt;code&gt;@Configuration&lt;/code&gt; annotation will be used in configuring the &lt;code&gt;ApplicationContext&lt;/code&gt; in Spring&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;DataSource&lt;/code&gt; with the Spring &lt;code&gt;@Bean&lt;/code&gt; is created &lt;/li&gt;
&lt;li&gt;A &lt;code&gt;UserDao&lt;/code&gt; Spring &lt;code&gt;@Bean&lt;/code&gt; is created, calling the &lt;code&gt;dataSource()&lt;/code&gt; method on the &lt;code&gt;DataSource @Bean&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  ApplicationContext
&lt;/h1&gt;

&lt;p&gt;Spring uses the &lt;code&gt;ApplicationContext&lt;/code&gt; to determine what &lt;code&gt;@Bean&lt;/code&gt;s to instantiate and inject into dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.ApplicationContext&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.AnnotationConfigApplicationContext&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;javax.sql.DataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApplication&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// (1)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="nc"&gt;ApplicationContext&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AnnotationConfigApplicationContext&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MyApplicationContextConfiguration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt; &lt;span class="nc"&gt;UserDao&lt;/span&gt; &lt;span class="n"&gt;userDao&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getBean&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UserDao&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// (2)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;userDao&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;userDao&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getBean&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// (3)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// etc ...&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Construct an &lt;code&gt;ApplicationContext&lt;/code&gt; by passing in &lt;code&gt;MyApplicationContextConfiguration&lt;/code&gt; class, which will create a &lt;code&gt;UserDao&lt;/code&gt; and a &lt;code&gt;DataSource&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Get the fully configured &lt;code&gt;UserDao&lt;/code&gt;, including its dependency on a &lt;code&gt;DataSource&lt;/code&gt; for JDBC connection&lt;/li&gt;
&lt;li&gt;We can also get the exact same instance of the &lt;code&gt;DataSource&lt;/code&gt; used in &lt;code&gt;UserDao&lt;/code&gt; from the &lt;code&gt;ApplicationContext&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using @ComponentScan to inject @Components
&lt;/h2&gt;

&lt;p&gt;We don't need to tell Spring to look at our Application Context Configuration to figure out what &lt;code&gt;@Bean&lt;/code&gt;s exist in our application. Instead, we can tell Spring where it can look for other &lt;code&gt;@Component&lt;/code&gt;s in our application using the &lt;code&gt;@ComponentScan&lt;/code&gt; annotation on our main &lt;code&gt;Application&lt;/code&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.Bean&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.ComponentScan&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.Configuration&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nd"&gt;@Configuration&lt;/span&gt;
&lt;span class="nd"&gt;@ComponentScan&lt;/span&gt;&lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// (1)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApplicationContextConfiguration&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="nd"&gt;@Bean&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="nf"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="nc"&gt;MysqlDataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MysqlDataSource&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setUser&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setPassword&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"s3cr3t"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setURL&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"jdbc:mysql://localhost:3306/myDatabase"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="c1"&gt;// (2)&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="c1"&gt;// no more UserDao @Bean method!&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Without any arguments, Spring will look for @Components in all Java classes in the same package&lt;/li&gt;
&lt;li&gt;Why don't we need the UserDao @Bean in the Application Context Configuration anymore?
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;javax.sql.DataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.stereotype.Component&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nd"&gt;@Component&lt;/span&gt; &lt;span class="c1"&gt;// (1)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserDao&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nf"&gt;UserDao&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// (2)&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Spring now knows the &lt;code&gt;UserDao&lt;/code&gt; is a dependency it should manage and inject where needed&lt;/li&gt;
&lt;li&gt;How does Spring know what to provide to the &lt;code&gt;UserDao&lt;/code&gt; for its DataSource dependency?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While not required in the latest versions of Spring (4.2 and later), the &lt;code&gt;@Autowired&lt;/code&gt; annotation can be used to explicitly mark the constructor injection method as dependent on the &lt;code&gt;DataSource @Bean&lt;/code&gt; Spring will create.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;javax.sql.DataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.stereotype.Component&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.beans.factory.annotation.Autowired&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nd"&gt;@Component&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserDao&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt; &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nf"&gt;UserDao&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@Autowired&lt;/span&gt; &lt;span class="nc"&gt;DataSource&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;        &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataSource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Injection Methods&lt;br&gt;
• Constructor&lt;br&gt;
• Setter&lt;br&gt;
• Field&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;p&gt;Code examples used in this blog were adapted from &lt;a href="https://www.marcobehler.com/guides/spring-framework#_introduction"&gt;Marco Behler's &lt;em&gt;What is Spring Framework?&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>spring</category>
      <category>opensource</category>
    </item>
    <item>
      <title>We started a developer meetup</title>
      <dc:creator>Michael Lamb</dc:creator>
      <pubDate>Wed, 29 Jan 2020 23:25:31 +0000</pubDate>
      <link>https://dev.to/themichaellamb/we-started-a-developer-meetup-264i</link>
      <guid>https://dev.to/themichaellamb/we-started-a-developer-meetup-264i</guid>
      <description>&lt;p&gt;C Spire is a technology and telecommunications company headquartered in Ridgeland, Mississippi. I have been a full-time Software Developer here since December 2016. I wanted to work for C Spire because I believed that it corporately understands the importance of computer literacy. Evidenced by a growing number of initiatives like the Tech Movement, the C Spire Coding Challenge, and the Software Development Pathway, this faith has been well-placed. I'm glad I work for a company that invests in its community so intentionally.&lt;/p&gt;

&lt;p&gt;In June 2019, I was approached by our Application Systems Architect team to discuss establishing some cultural changes to help the C Spire developer community. Just as in any enterprise-level company, information gets siloed and teams will sometimes work on redundant operations––or worse, they might work &lt;em&gt;against&lt;/em&gt; each other. There are disparate standards, tools, and languages between development teams. Junior developers often don't even understand how a project starts and ends, let alone who determines requirements and specifications. The common solution for problems like these is to promote communication, which was exactly what the Architect group wanted to do. So, we set about writing a mission statement to establish our own initiative.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmkett38n3hr6u0j0k2d9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmkett38n3hr6u0j0k2d9.png" alt="C Spire I/O Mission Statement: To foster a culture at C Spire for developers to encourage engagement, operational excellence, self-learning, and professional development."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The way we wanted to execute this mission was to create an internal forum, communicate the goals of our efforts, and invite developers to speak on a wide array of topics. &lt;/p&gt;

&lt;h4&gt;
  
  
  Audience
&lt;/h4&gt;

&lt;p&gt;The medium of a developer meetup would help us generate creative collisions between a wide audience at the company. We targeted our IT, Network, and HR departments. IT itself is comprised of a number of groups including web and application developers, UX designers, analysts, DBA, BI, QA, Billing, and Operations. HR and Network both have their own development teams. Network is responsible for infrastructure and they develop their own monitoring and reporting tools in-house.&lt;/p&gt;

&lt;p&gt;Bringing in such a diverse audience has been rewarding and challenging. We have to organize our speakers so that their talks are enlightening to people who might otherwise be disengaged or unaware of their topic. Sometimes, speakers don't think their areas of expertise are interesting––though this is a problem we have yet to really face for an I/O session. Our audience, then, is really just the people we work with but don't know much about. As an organization, we keep finding ourselves with groups who send a speaker to say to our audience: this is who we are and what we do; how can we help you?&lt;/p&gt;

&lt;h4&gt;
  
  
  Goals
&lt;/h4&gt;

&lt;p&gt;Even though the company clearly has a strong understanding of why computer science and software engineering are vital to collective success, we couldn't pitch a developer meetup without establishing why it was important to C Spire. We identified these goals which would help us measure the impact of our meetup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lower developer churn&lt;/li&gt;
&lt;li&gt;Foster learning and developer contribution&lt;/li&gt;
&lt;li&gt;Encourage cross-team culture sharing&lt;/li&gt;
&lt;li&gt;Establish and communicate C Spire best practices&lt;/li&gt;
&lt;li&gt;Reduce complacency and encourage creativity&lt;/li&gt;
&lt;li&gt;Shift the paradigm toward CI/CD&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  So began C Spire I/O
&lt;/h1&gt;

&lt;p&gt;The Architects, a System Analyst from my team, an intern, and myself were the core group planning what we decided to call C Spire I/O. The name came from the guiding principles of innovation and openness, but on a less high-minded level we were just ripping Google's I/O conference. The company name C Spire comes from our vision to be "customer inspired" so I like to think we are just borrowing inspiration.&lt;/p&gt;

&lt;p&gt;The support we received for I/O from the leadership in IT was incredible. Managers bought in to the idea and agreed to honor the time we organized I/O sessions by encouraging their teams to attend and participate. Executive leadership gave us a blank check to make an event we would be proud to produce. What meant the most to me, though, was that everyone I talked to seemed to recognize what we're doing as a good thing, not just something that's necessary.&lt;/p&gt;

&lt;h4&gt;
  
  
  2019 Accomplishments
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;We predicted that we might average 40-50 attendees at each session. In 2019, we hosted 7 sessions with an average of 92 people attending!&lt;/li&gt;
&lt;li&gt;Since our focus is internal, the speakers for each session come from the 20 groups that participate in I/O. 14 of those groups were represented.&lt;/li&gt;
&lt;li&gt;21 different talks ranged from themes of Requirements, Architecture, Development, and Deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2020 Aspirations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;We are targeting 12 dates to host I/O sessions throughout the year&lt;/li&gt;
&lt;li&gt;We want to improve the remote experience of I/O sessions to increase engagement at C Spire offices around the nation&lt;/li&gt;
&lt;li&gt;We hope to bring in external speakers &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Talk about your passions
&lt;/h4&gt;

&lt;p&gt;As I reflect on how this all started, I remember a story from my first year at C Spire. In August 2017, the company held a hack-a-thon style event called Ideathon where groups would workshop their ideas to present to a board not unlike the well-known Shark Tank. I was still fresh under the gills and getting used to working in a corporate environment but I was curious as to what might happen.&lt;/p&gt;

&lt;p&gt;I found a group of colleagues and we hashed out plans for a community coding club. The idea was not entirely the same as C Spire I/O because it wasn't specifically about development happening within the company. We rooted our conversation in how to best help people who were interested in learning how to create software for people with no experience. After drawing up a mock schedule filled with lecture series, workshops, and social events, I volunteered to give our 5-minute pitch. I think the passion I felt for creating community around technology became apparent while I spoke on all the ideas the group had come up with and stood by it. Even though our pitch didn't win the competition, I was proud to be company to others who were just as excited about computer science literacy and the many ways we might be able to impact our community by sharing our knowledge.&lt;/p&gt;

&lt;p&gt;The drive to make software development an accessible skill aligns with C Spire's efforts to raise the bar in Mississippi. Only about half of the high schools in the state offer computer science courses, so the need here is great. Software creates so much opportunity for innovation, creativity, and community. To be included as a founding board member of C Spire I/O is an honor though it also seems it was inevitable. The lesson I've learned here is to talk about your passions and the people who are excited and able to help you will find you. &lt;/p&gt;

&lt;p&gt;I hope that developers at C Spire young and old will see I/O as an platform for them to speak about their passions.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>devrel</category>
      <category>community</category>
      <category>culture</category>
    </item>
    <item>
      <title>Why Smart City Technology Shouldn't Be Considered Out of Reach</title>
      <dc:creator>Michael Lamb</dc:creator>
      <pubDate>Tue, 06 Aug 2019 01:13:37 +0000</pubDate>
      <link>https://dev.to/themichaellamb/why-smart-city-technology-shouldn-t-be-considered-out-of-reach-183b</link>
      <guid>https://dev.to/themichaellamb/why-smart-city-technology-shouldn-t-be-considered-out-of-reach-183b</guid>
      <description>&lt;p&gt;The future of smart city technology is here. The opportunities presented by grassroots public infrastructure movements should be enough evidence for the work to be done. So let's start doing it.&lt;/p&gt;

&lt;p&gt;The best smart cities are data-driven cities. The best data comes from the Internet of Things. The best Internet for those things is driven by connectivity. Connectivity is what integrators do best. Technology companies should be integrators. Sensor technologies can provide cities and citizens greater understanding of their surroundings by creating connections that propagate change. Small cell technologies enable robust, mobile connections more quickly and with greater ease of operation. Any company that can excel in this area will see the benefits. &lt;/p&gt;

&lt;p&gt;Though I speak highly of the smart city potential, it is not without caveats. There are bureaucratic entanglements that tie up so many possibilities for partnerships between integrators and utilities companies. But the crowd can source its own way, too.&lt;/p&gt;

&lt;p&gt;The Internet of Things opens up the doors to so many great features for families. Imagine automating a small garden to keep fresh food close to home. Think about setting up a mesh network along the path between your house and your beehives, about a 10 minute walk through the woods; reporting back could be a scale to measure the hive weight, or a thermometer to track the temperature. A small camera could be used to train a model to track the total population of bees. &lt;/p&gt;

&lt;p&gt;All of these use cases are within reach, if only we are courageous enough to put in the work. &lt;/p&gt;

</description>
      <category>smartcity</category>
      <category>technology</category>
      <category>networking</category>
      <category>iot</category>
    </item>
    <item>
      <title>Senior Design Prepared Me for Real Life Development</title>
      <dc:creator>Michael Lamb</dc:creator>
      <pubDate>Tue, 23 Jul 2019 15:54:57 +0000</pubDate>
      <link>https://dev.to/themichaellamb/senior-design-prepared-me-for-real-life-development-3ikd</link>
      <guid>https://dev.to/themichaellamb/senior-design-prepared-me-for-real-life-development-3ikd</guid>
      <description>&lt;p&gt;This is the story of how I became a software developer.&lt;/p&gt;

&lt;h2&gt;At first, I wasn't&lt;/h2&gt;

&lt;p&gt;I was an English major. Well, before that I was studying Biblical Literature. And before that I was studying Music. And finally before that I was studying English.&lt;/p&gt;

&lt;p&gt;Twice in that list I say I study English. I started off that way and ended that way in 2012 when I found myself in attendance of the Broadening Participation in Computing at Mississippi State University. Yes, I declared English as my major two different times. The first was at a bible college that doesn't exist anymore. The second was after the school shut down. Life is great when it makes no sense.&lt;/p&gt;

&lt;p&gt;I was studying Spanish to satisfy the basic requirements for an English degree when I met Daniel. Daniel introduced me to the BPC program because he had experienced it himself. He highly recommended it, and so I applied. I went to my favorite teacher at Hinds CC, Mrs Kathy Smith, and asked her to recommend me for the program. She agreed to show me the kindness of providing me a letter which acknowledged an ability to critically analyze a story and understand the differing motivations possible to explain the author's intent. &lt;/p&gt;

&lt;p&gt;That's a skill I've found quite handy in reading code written by my coworkers. Does it sound complicated? It's really not. There are a million little things developers try to understand — and they all tend to bubble up in design patterns. Systems of design are intentional. The care put into them requires your attention if you plan on being able to improve them. &lt;/p&gt;

&lt;p&gt;The rest of my college career was designed by people who generally understood that designing systems requires intention. My process for selecting to pursue a Bachelors of Science degree in Software Engineering at Mississippi State University was aided by a well-designed flow of balancing conversations about the pros and cons of other comparable programs; I am grateful for the counsel of many community members who gave me advice and impacted my life. Seeing the unique benefits offered at MSU, I decided that Starkville would be my home for a while.&lt;/p&gt;

&lt;h2&gt;1.5 years later, I was ready for Senior Design&lt;/h2&gt;

&lt;p&gt;The project was simple. Build a website to manage a library of audiobooks.&lt;/p&gt;

&lt;p&gt;The project was not simple. The website's main audience was going to be people who could not see. What happened next has shaped how I understand my job, and I couldn't be more grateful for its impact. &lt;/p&gt;

&lt;p&gt;Our team was large for my taste. 9 people total. But it seemed like everyone else understood we had too many people to form a single, cohesive group that could last an entire semester. We selected a project manager. He broke us up into 3 teams with separate concerns. There was even further fragmentation as one person took it upon himself to completely own all database components and he created a single way to write all our business logic in PHP. We self-selected our sub-teams: backend devs writing PHP, frontend devs writing HTML, JS, and CSS using Bootstrap, and an integration team which handled reviewing and handling the logistics that tied the two together. I joined the integration team. &lt;/p&gt;

&lt;p&gt;9 people seemed perfect, now. We had stuff figured out. We knew what we were doing.&lt;/p&gt;

&lt;h3&gt;Except for all the mistakes&lt;/h3&gt;

&lt;p&gt;We did some things well but there were plenty of little things I'd change now that would have saved time back then. &lt;i&gt;C'est la vie.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;We poorly practiced trunk-based-development. Since everyone's concerns were primarily structured the same way using the Model-View-Controller paradigm, I ended up benefitting by getting a little exposure to a lot of different ways of thinking. This came in handy when comparing the mistakes I made in my team to the mistakes made in the other teams. &lt;/p&gt;

&lt;p&gt;Frontend designers think differently when they have to spend time working with their users. That's where the requirements are gathered, really. Accessibility means your users are able to use your software. It can offer long periods of uncertainty in whether your work will be ultimately meaningful. Not every idea we have can survive forever, especially when there is a disparity between the users and the designers. &lt;/p&gt;

&lt;p&gt;Our meeting notes included phrases like, "This doesn't make sense to me!" There was no note afterward indicating this had changed for the author. The difficulty arose from a misunderstanding between the author, her colleague, and two of the clients. There is still so much I have to learn about creating inclusive technology experiences when writing new software, but this project was where I first considered what truly accessible software means.&lt;/p&gt;

&lt;p&gt;Backend designers are typically focused on analytics. This has been where I've found myself professionally. Learning from frontend designers became normal. Writing code that could be consumed by the frontend designers made it so that I was interested in listening to their complaints. If I could make it easier for them to work with us, I'd need information on their roadblocks. That meant errors. &lt;/p&gt;

&lt;p&gt;Some of those errors were mine. Some of those errors belonged to others. All the errors were rooted in not understanding something. Maybe the software didn't 'understand' some input or the person who wrote it made a mistake or the actor tried to make the software do something it couldn't. Perhaps the software was configured incorrectly or something happened to the network. It is possible that some of my colleagues even went through breakups that affected their emotional states while writing their code, leading them to make assumptions just because they weren't interested in their work. All of these things were questions I ended up having while learning how to work with two separate groups that weren't always talking to each other.&lt;/p&gt;

&lt;p&gt;Recognizing that this happens often in life shifted how I processed my own failures over time. Sometimes the failures ended up leaving some shame for changing my mind so often. The times I felt some grief at the different lives I might have lived if I had continued on in English or Music were met with meaningful friendships that have become pillars. Accessibility all starts with feeling empathy for the person who reads what you write, whether by being the actor or reviewing the design.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>seniordesign</category>
      <category>education</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
