Skip to content

Instantly share code, notes, and snippets.

#spring [#spring-boot]{}

Question

Property files, how do they work in Spring?

Answer

If a bean class is annotated with @PropertySource, when Spring is conjuring this bean Spring will also loads property file it defines.

@bluearth
bluearth / springbootapplication_annotation_vs_commandlineruner.md
Last active February 7, 2024 23:50
What's the difference between a class that is annotated using @SpringApplication and a class that implements ApplicationRunner or CommandLineRunner?

Tags: #spring #spring-boot

Question:

What's the difference between a class that is annotated using @SpringBootApplication and a class that implements ApplicationRunner or CommandLineRunner?

Which one do I need?

Short Answer

@bluearth
bluearth / reston_workstream_bom.md
Created July 21, 2023 09:43
Software requirements for Reston workstreams
@bluearth
bluearth / react_controlled_vs_uncontrolled_functional_component.md
Last active October 1, 2022 02:37
I always find my self in need to get back to React's official documentation on Controlled vs Uncontrolled component. But the official docs is written with older, class-based component, in mind. So I keep this example here to refer to from time to time. Here it is, Controlled vs Uncontrolled Functional Component example.

React's Controlled vs Uncontrolled Functional Component Example

I always find my self in need to get back to React's official documentation on Controlled vs Uncontrolled component. But the official docs is written with older, class-based component, in mind while React community have move on to the more recent functional component.

I keep this example here to refer to get back to in the future. So, here it is, Controlled vs Uncontrolled Functional Component example:

import "./styles.css";
import { useState, useRef } from "react";
@bluearth
bluearth / java_17_lts_preparation.md
Created May 9, 2021 17:33
Java will be reaching it's next LTS version soon ([Nov 2021](https://openjdk.java.net/projects/jdk/17/)), that is Java 17. After the first (Java 8, Mar '14) and second (Java 11, Sept '18) LTS, it is worth to pay attention what the next LTS release will bring as it will be considered the standard for years to come. So I sit for couple of hours (l…

Java will be reaching it's next LTS version soon (Nov 2021), that is Java 17. After the first (Java 8, Mar '14) and second (Java 11, Sept '18) LTS, it is worth to pay attention what the next LTS release will bring as it will be considered the standard for years to come. So I sit for couple of hours (literally) to browse through past releases just to keep my self abreast of what has been going up until today.

Here's my notes.

J2SE 1.3 (Kestrel), May 2000

API

  • Java Naming and Directory Interface (JNDI)
  • JavaSound
  • RMI (updated to support CORBA compatibility)
@bluearth
bluearth / ldap_from_dotnet_app.md
Last active May 6, 2021 08:16
Interacting with LDAP from .NET app

There are three main APIs .NET app can use to interact with LDAP service. These three APIs lives under the System.DirectoryServices namespace or S.DS for short. The purpose of this note is to orient my self when searching for AD or LDAP related problems in .NET (and .NET core).

Examples below are in Powershell for rapid testing. Transalting to C# or other CLR language shouldn't be an issue.

Low level API (S.DS.Protocols namespace)

This suite of API provide low level access to the LDAP protocol. You would have to have knowledge of how the server is configured and the details of LDAP protocol.

Here's an example of LDAP Bind operation.

@bluearth
bluearth / free_icons.md
Last active April 25, 2021 13:19
Here are the list of free icon set for web and mobile apps
@bluearth
bluearth / webapp_url_pattern_cheat_sheet.md
Created April 5, 2021 16:48
This cheatsheet serve as framework and language neutral reference for web application URL pattern

List

Basic URL pattern:

GET /entities
@bluearth
bluearth / custom_powershell_prompt.md
Last active January 31, 2021 15:50
I found my self having to work with powershell (pwsh) quite often. To make things better, I decided to customize my pwsh prompt. Here's how

I found my self having to work with powershell (pwsh) quite often. To make things better, I decided to customize my pwsh prompt to be able to:

  1. Show current time. When I'm executing long running task like GAE deployments, I switch to other task or do other things while waiting. When I return to pwsh and the task has completed, having time indicator in the pwsh prompt can help determine when exactly the task has been completed.
  2. Show current path. The need for this is quite obvious and the default pwsh prompt already shows the current path
  3. Show current branch if inside git working directory. This feature can be found in git consoles. I want to have similar feature in my pwsh prompt.
  4. Have all that color coded for visual aid
@bluearth
bluearth / curl_json_pp_pygmentize.md
Last active December 22, 2020 16:11
So you need to Invoke a HTTP API that returns JSON but you dont want to leave the comfort of your console. And you want the JSON response to be well formatted and color-highlighted

So you need to Invoke a HTTP API that returns JSON but you dont want to leave the comfort of your console. And you want the JSON response to be well formatted and color-highlighted.

You'll need:

  1. cURL
  2. json_pp
  3. pygmentize

You can just apt install all of them

Here's an example: