Saturday, January 30, 2021

Spring Bean: Is autowired attribute initialised before constructor?

https://stackoverflow.com/questions/26230493/spring-bean-is-autowired-attribute-initialised-before-constructor


  1. First Constructor is called
  2. Then Spring Bean is initialized

Unicode to Character - How ?

https://www.branah.com/unicode-converter

Maven to Spring Application.Properties - Profile

 #server.port=8081

spring.profiles.active=@activatedProperties@

https://www.petrikainulainen.net/programming/tips-and-tricks/creating-profile-specific-configuration-files-with-maven/


<profiles>

<!-- DEV Build -->

<profile>

<id>DEV1</id>

<properties>

<activatedProperties>DEV1</activatedProperties>

</properties>

</profile>


<!-- AZURE Build -->

<profile>

<id>QA</id>

<properties>

<activatedProperties>QA</activatedProperties>

</properties>

</profile>

@Service classes are being created twice when the application starts.

https://stackoverflow.com/questions/4333390/service-are-constructed-twice


You're doing two separate component-scans over the same base-package. Remove one of them.
Make the following changes

myapp-config.xml

<!-- Load everything except @Controllers -->
<context:component-scan base-package="com.myapp">
    <context:exclude-filter expression="org.springframework.stereotype.Controller"
        type="annotation"/>
</context:component-scan>

myapp-servlet.xml

<!-- Load @Controllers only -->
<context:component-scan base-package="com.myapp" use-default-filters="false">
    <context:include-filter expression="org.springframework.stereotype.Controller" 
        type="annotation"/>
</context:component-scan>

CURL Headers Base64 Authorization

curl --location --request POST 'https://test.salesforce.com/services/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: BrowserId=4jzphkElEeu76TsJSxG4Tw' \
--data-urlencode 'client_id='a2rtyoi.k9iosdgh.b6rbmnb' \
--data-urlencode 'client_secret=23987590772833' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=foo@bar.com' \
--data-urlencode 'password=Red1$Apple'

curl --location --request GET 'http://10.102.13.101:8086' --header 'Authorization: Basic base64[username:Password]
curl --location --request GET 'http://AZ-CVS-LI-RE-02:8086' --header 
'Authorization: Basic U2hlZXRhbFM6ZWYxNTE1NWY3YTJjOGNiZWIyYjM3N2Q0NmQ2ZWRkYzkzOTg3NjljYTlhMzUyOTkwZDFhYjI1MzcxNDAyNzJiYQ=='

Friday, January 29, 2021

Code Syntax Highlighter in Blogger

Use this website 

https://tohtml.com   - It generates HTML

https://codebeautify.org/alleditor   - It just formats Code

http://hilite.me/  - It generates Line Number + Code Syntax Highlighter

Generate HTML code snippet and copy it in "HTML View" mode of Blogger



Thursday, January 28, 2021

Bean Create Dynamically in Spring with Params ?

package org.springframework.beans.factory.config;
public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
	String SCOPE_SINGLETON = ConfigurableBeanFactory.SCOPE_SINGLETON;
	String SCOPE_PROTOTYPE = ConfigurableBeanFactory.SCOPE_PROTOTYPE;
}

Beans can be "prototype" - Bean generated afresh at each call
or It can be "singleton" - One Bean for all Calls




How to pass parameters dynamically to Spring beans @Bean
@Configuration
public class ApplicationConfiguration {
  @Bean
  @Scope("prototype") //As we want to create several beans with different args, right?


Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass