Tomcat 7 Default Administrator Password

Tomcat 7 Default Administrator Password

Tomcat 7 Default Administrator Password By default you can see the below content in tomcat-users.xml file under (apache-tomcat-7.0.88\conf) By default nothing is configured so add your own username and password for manager-gui roles to get the access for Manager App & Host Managers. <?xml version=’1.0′ encoding=’utf-8′?> <!– Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file…

Read More Read More

257 total views, 4 views today

Arraylist to Array Using ToArray() in java

Arraylist to Array Using ToArray() in java

Syntax: <T> T[] toArray(T[] a) Eg : String[] y = x.toArray(new String[0]); T – the runtime type of the array to contain the collection Parameters: a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose. Returns: an array containing the elements of this list Throws: ArrayStoreException – if the runtime type of the specified array is not a…

Read More Read More

608 total views, 18 views today

hashMap Vs TreeMap Vs LinkedHashMap

hashMap Vs TreeMap Vs LinkedHashMap

════════════╦═════════════════════╦═══════════════════╦═════════════════════╗ ║ Property ║ HashMap ║ TreeMap ║ LinkedHashMap ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Iteration ║ no guarantee order ║ sorted according ║ ║ ║ Order ║ will remain constant║ to the natural ║ insertion-order ║ ║ ║ over time ║ ordering ║ ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Get/put ║ ║ ║ ║ ║ remove ║ O(1) ║ O(log(n)) ║ O(1) ║ ║ containsKey ║ ║ ║ ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ ║ ║ NavigableMap ║ ║ ║ Interfaces ║ Map ║ Map ║ Map ║…

Read More Read More

600 total views, 2 views today

Bean validation in Spring Rest using @Valid

Bean validation in Spring Rest using @Valid

Bean validation in Spring Rest using @Valid: Bean validation is important to validate the input bean received in the spring restful requestbody. And also default error messages may not be properly understandable by our consumers, so validating the bean and responding the proper readable message to our consumers makes our spring restful webservice better.   How are we going to do ?   1. Add the validation annotations to the bean fields(preferrably your Dto class), following are the supported annotations…

Read More Read More

310 total views, 10 views today

Entity to DTO using Model Mapper in Spring Restful Web services

Entity to DTO using Model Mapper in Spring Restful Web services

Entity to DTO using Model Mapper in Spring Restful Web services: In spring restful webservices we can not directly expose our entity pojo classes as json responses as it has lot of issues like security/unwanted data’s exposure etc. Data Transfer Object (DTO) is a design pattern which actually resolves this issue. I am going to do these sample in spring boot project. In highlevel idea behind this is, Create the DTO pojo classes for all/required of your Entities. 2. Write…

Read More Read More

338 total views, 3 views today

GenerationType.IDENTITY vs GenerationType.SEQUENCE vs GenerationType.AUTO

GenerationType.IDENTITY vs GenerationType.SEQUENCE vs GenerationType.AUTO

GenerationType.IDENTITY vs GenerationType.SEQUENCE vs GenerationType.AUTO: In hibernate for the primary key/auto generated id value column we used to annotate @GeneratedValue with strategy as either of these, GenerationType.IDENTITY 2. GenerationType.SEQUENCE 3. GenerationType.AUTO   It is highly important to understand the difference between these generation types to make it fit in the right place. Suppose you have two tables namely store and coupon, store id is a primary key in store table and foreign key in coupon table. Store table: store_id |…

Read More Read More

581 total views, 1 views today

Difference between @Inject and @Autowired

Difference between @Inject and @Autowired

Difference between @Inject and @Autowired This is one of the important interview question of spring / spring boot framework interviews. Auto-wiring is the great feature we got to wire our application dependencies spring way, but it can be done by both JSR annotation and spring provided annotation. It is important to know the difference between these both to make use of it effectively in real time use-cases. @Inject: Does not have ‘required’ attribute Throws exception if the dependency not found….

Read More Read More

401 total views, no views today

When does spring create instances to be injected ?

When does spring create instances to be injected ?

When does spring create instances to be injected ? This is one of the famous spring / spring boot framework interview question. Spring creates the instances to be injected during the start up. If you have configured spring beans with lazy-init attribute then spring creates the instances of those bean only when you inject/any of it’s dependencies injects it. By default, Application Context creates the instances of all the beans eagerly with singleton scope during it’s initialization process only. 269 total…

Read More Read More

269 total views, 1 views today

Why StringBuffer/StringBuilder should be avoided in HashMap?

Why StringBuffer/StringBuilder should be avoided in HashMap?

Why StringBuffer/StringBuilder should be avoided in HashMap?   This is one of the core java interview question under collections category. Generally in all the map manipulations we use string and avoid stringbuffer and stringbuilders, because both are mutable. What is the issue if is mutable ? If you are keeping your hashmap’s key/value as stringbuilder/stringbuffer then once after you inserted the value in the map, if any of the key/value modified then it actually affects inside the map as well,…

Read More Read More

354 total views, no views today

[Resolved] Spring boot JWT Filter called twice

[Resolved] Spring boot JWT Filter called twice

[Resolved] Spring boot JWT Filter called twice: Recently when I was integrating JWT Filter and Simple CORS filter in my spring boot project, I observed that both the filters are called twice before actually reaching my servlet/rest controller.   After googling, I got this link, As per that, One invocation is by servlet container and the other is by Spring Security, so the filter will get called twice. So by adding this line in your JWT Filter bean implementation registrationBean.setEnabled(false); only…

Read More Read More

557 total views, 3 views today