April 29, 2019

Running Main Java Class inside Spring Boot Jar Application

Assume that I have an application built using Spring Boot technology and I want to run a Java class "with main method" inside the boot jar file without running the boot application.

Assumptions:
- Spring Boot application jar name is "MyApp.jar"
- The Spring Boot starter class is "sawalha.boot.ApplicationStarter"
- The Java class with main method is "sawalha.stnd.NonSpringApplication"

To run  NonSpringApplication without running the whole Spring application is:

java -cp MyApp.jar -Dloader.main=sawalha.stnd.NonSpringApplication org.springframework.boot.loader.PropertiesLauncher

Eclipse Java and HTML Code Formatter

This Code Formatter is used for Eclipse Version 2018-09 (4.9.0) and above.

1. Download the following files:




2. Open Eclipse

3. Go to Windows → Preferences → Java → Code Style → Clean Up


4. Click Import and select eclipse_clean-up.xml, click Apply.

5. Go to Windows → Preferences → Java → Code Style → Formatter


6. Click Import and select eclipse_formatter.xml, click Apply.

7. Go to Windows → Preferences → Java → Editor → Save Action
Setup as following:


8. Go to Windows → Preferences → Web → Editor → HTML Files → Editor
Set the following parameters:
  • Line width = 80
  • Check “Split multiple attributes each on a new line”
  • Click “Indent using spaces”
  • Indentation size = 4



9. Go to Windows → Preferences → Web → JavaServer Faces Tools → Validation 
Set "Applying operator to method binding" to Warning or Ignore