Create as .sh file add jar execution command
/usr/bin/java -jar /u01/api/docuchat-api-0.0.1.jar --spring.config.location=file:/u01/api/config/ > /u01/api/logs/springboot.log
in you case you can use only /usr/bin/java -jar jarname.jar
Create as .sh file add jar execution command
/usr/bin/java -jar /u01/api/docuchat-api-0.0.1.jar --spring.config.location=file:/u01/api/config/ > /u01/api/logs/springboot.log
in you case you can use only /usr/bin/java -jar jarname.jar
Record is a certain type of class. It is also special type of class.
We can create recording like below
public record EmployeeRecord(String name, int employeeNumber) {
}
We can access the name, employeeNumber, as below
For Example: EmployeeRecord record = new EmployeeRecord("Dinesh", 24);
record.name();
record.employeeNumber();
- if you declare record instance variables are final by default.
- toString(), hashCode() & equal() are overrided automatically.
- We can't extend any class or record
- we can implement the interface at end before flower braces
- By default the records is final. we don't required to declare final variable.
- By default Canonical Constructor is created.
- We can declare the variable with static final
- we can declare the static methods
Canonical Constructor is a constructor that is created with all instance fields as a parameters
for example from above code
public EmployeeRecord (String name, int employeeNumber ) {
this.name = name;
this.employeeNumber = employeeNumber;
}
- if you want override constructor you can do. Why do we required to override constructor is if need to do some validation like age should not be negative then you can throw exception if required.
- We can use Compact Constructor instead of overriding it.
What is the Compact Constructor?
Compact Constructor with our argument or bracket we can declare need to declare as below
public EmployeeRecord {
if (employeeNumber < 0) {
throw new ILegalArgumentException("Not valid number");
}
}
Perquisites: Need to have Keytool (which is present in the Jdk bin folder)
For generating the key store need to enter in the command prompt the below
keytool -genkey -alias docx -keyalg RSA -keystore docx
Beside alias you need give the file generation name. I have given docx. you can change the keystore value.
Once you enter in the command prompt the below will be generated
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: test.test.com
What is the name of your organizational unit?
[Unknown]: test
What is the name of your organization?
[Unknown]: test
What is the name of your City or Locality?
[Unknown]: Singapore
What is the name of your State or Province?
[Unknown]: Singapore
What is the two-letter country code for this unit?
[Unknown]: SE
Is CN=test.test.com, OU=Agility, O=test, L=Singapore, ST=Singapore, C=SE correct?
[no]: yes
Once the activity is completed a file is generated with docx from the above command.
If you required the .csr file to be generate from the docx file need to run the below command.
c:\temp>keytool -certreq -keyalg RSA -alias docx -file docx.csr -keystore docx
once click enter then it will ask for password.
Enter keystore password:
File will be generated.
After getting the root.crt, intermidate.crt & servercertificate.crt file
Run the below commands in the server
keytool -import -alias root -keystore docxuat -trustcacerts -file root.crt
keytool -import -alias intermediate -keystore docx -trustcacerts -file intermediate.crt
keytool -import -alias docx -keystore docx -file ServerCertificate.cr
------------------------
once done for applying in the network need to run the below commands
keytool -importkeystore -srckeystore docx.jks -destkeystore docx.p12 -deststoretype PKCS12 -srcalias docx -srcstorepass Agility@123 -srckeypass Agility@123 -destalias docx -deststorepass Agility@123 -destkeypass Agility@123
openssl pkcs12 -in docx.p12 -nocerts -nodes -out docx.key
openssl pkcs12 -export -out docxfinalcrt.pfx -inkey docx.key -in docx.txt
In Spring MVC i tried to apply the cors i got the issue
Multiple annotations found at this line:
- Start tag of element <mvc:cors>
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element mvc:cors
before solution below was displayed
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"
To Solve the issue i changed to (removed version) then worked
http://www.springframework.org/schema/mvc/spring-mvc.xsd"
mongoimport --drop -d blog -c posts posts.json