Skip to main content

Posts

Showing posts from 2023

Git menu is not shown up in IntelliJ IDEA 2023.1.1 (Community Edition)

  Problem :  If you have upgraded your IntelliJ IDEA to IntelliJ IDEA 2023.1.1 (Community Edition), then most probably the Git menu will not be shown up. Solution : a) Your project is running in safe mode, you need to trust this project b) Try the new UI of IntelliJ like the following

jdk 21: The new features in Java 21

JDK 21 is scheduled to be released in September 2023 as specified in    JSR 395 . The main 3 features included in JDK 21  are  a) Sequenced Collections According to  OpenJDK , a sequenced collection has first and last elements, and the elements between them have successors and predecessors. A sequenced collection supports common operations at either end, and it supports processing the elements from first to last and from last to first (i.e., forward and reverse). b)  Virtual Threads According to OpenJDK ,  Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications. c)  String Templates (Preview)  According to OpenJDK ,  Enhance the Java programming language with  string templates . String templates complement Java's existing string literals and text blocks by coupling literal text with embedded expressions and  template process...

Java: How to split a string based on . (DOT) , (COMMA) : (COLON)

In Java language, DOT is a special character in the regular expression. If you have the following string String str = "He is a boy. He is my friend"; The following statement will return an empty string array String tokens[] = s.split("."); Solution: You can split a string based on DOT in the following two ways a) String tokens[] = str.split("[.]"); b) String tokens[] = str.split("\\."); The same solution also applies to the following characters a) WHITE SPACE  b) COMMA c) COLON Complete Example: public class StringSplit {      public static void main(String[] args ) {           String str = "He is a boy.He is my friend" ;           String tokens [] = str .split( "[.]" );           System. out .println( tokens [0]);           System. out .println( tokens [1]);          //or using escape character ...

git : unable to unlink old invalid argument

  Problem : If you get the following error while git checkout or git pull  git unable to unlink old [file name] invalid argument Solution Most probably the file is opened and locked in another application. Close that application and then try again, you will successfully continue with the respective git command.

Factory method 'filterChain' threw exception with message: This object has already been built

  Problem org.springframework.beans.factory.UnsatisfiedDependencyException : Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through method 'setFilterChains' parameter 0: Error creating bean with name 'filterChain' defined in class path resource [com/.class]: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method 'filterChain' threw exception with message: This object has already been built at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments( AutowiredAnnotationBeanPostProcessor.java:817 ) ~[spring-beans-6.0.4.jar:6.0.4] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject( AutowiredAnnotationBeanPostProcessor.java:769 ) ~[spring-beans-6.0.4.jar:6.0.4] at org.spri...