Wednesday, 2 October 2019

Spring Session


HTTP is a stateless protocol, meaning that all requests and responses are independent.

Http session is a way to keep states at a server-side. A cookie is another way to keep states in the client-side.

Spring session is a way to manage a cluster of Http sessions;  across sessions, including their persistence.

Spring Security Session

Spring Boot Session

Monday, 30 September 2019

how to edit pushed commit message


Open the Intellij,  Go to version control tab, then go to log.
Selecting a commit, press F2 and then edit the commit message.

Open git bash
Now it should see the bias between local and remote;
git pull; and it will merge the remote and local

It will popup a vi editor to ask for editing the merge message;
Edit the text;

Press ESC, and press shift + zz; then quit to the git bash command line.

now

now, the local will be ahead of the remote, do
git push.


Disable SpringBoot Security



My solution is to define a flag in property file, and injected it during the runtime;


Using the @Value, and maybe combined with @ProperySource , I am using spring boot 2.0 and found that the application property file already read in the Spring context.

spring-value-annotation



There are several options, the following may be an option for the boot 1.5

security.basic.enabled=false
management.security.enabled=false

Friday, 27 September 2019

Injecting Property Value in Spring boot 2


the property value active should be injected from the property file.

@Value("${spring.profiles.active}")
private String activeProfile;


spring-value-annotation


Kotlin

In general, Kotlin is an upgraded Java

Kotlin has no primitive types; only the Objects(wrapper classes in java)

Kotlin has no semi-coma, and keyword new,
Kotlin has no checked exceptions; so there is no forced catch.

Kotlin may have a single primary constructor defined at the class header.

By default, all classes defined are immutable, equal to final classes in Java; so it needs an open modifier to make it extendable.

Kotlin has no checked exception, all exceptions are derived from the throw-able.


Kotlin function can be independent of a class; by default, it is a static method, it must be a static method, for doesn't belong to any class. A function can be modified access modifiers. A private function means it can be only accessed within its file scope.






return Unit






Can Jackson Deserialize Java Time ZonedDateTime

Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...