Skip to content

Commit 1cd3801

Browse files
committed
Added simplest example; start Spring Boot app with parameters in EasyKey.maven
1 parent 491afe9 commit 1cd3801

File tree

4 files changed

+52
-59
lines changed

4 files changed

+52
-59
lines changed

EasyKey.maven/ezk-maven-functions.sh

Lines changed: 26 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,20 @@
11
#!/bin/bash
22

33
useFull() {
4-
echo "Validate JPA Entities on startup"
5-
echo "spring.jpa.hibernate.ddl-auto=validate"
6-
echo "Generate and log statistics"
7-
echo "spring.jpa.properties.hibernate.generate_statistics=true"
8-
echo "logging.level.org.hibernate.stat=DEBUG"
9-
# Log slow queries
10-
echo "spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS=1"
11-
# Log all SQL statements
12-
echo "logging.level.org.hibernate.SQL=DEBUG"
13-
# Log cache operations
14-
echo "logging.level.org.hibernate.cache=DEBUG"
15-
}
16-
17-
enableLogging() {
18-
echo "Root logger (global default logging level):"
19-
echo "logging.level.root=warn"
20-
echo "Stuff in my app:"
21-
echo "logging.level.com.myapp=DEBUG"
22-
echo "All Spring:"
23-
echo "logging.level.org.springframework=DEBUG"
24-
echo "Spring Web:"
25-
echo "logging.level.org.springframework.web=debug"
26-
echo "Display endpoints at startup:"
27-
echo "logging.level.web=TRACE"
28-
echo "logging.level.web=DEBUG"
29-
echo "Rest:"
30-
echo "logging.group.rest=org.springframework.web,org.springframework.http"
31-
echo "logging.level.rest=DEBUG"
32-
echo "Tomcat:"
33-
echo "logging.group.tomcat=org.apache.catalina, org.apache.coyote, org.apache.tomcat"
34-
echo "logging.level.tomcat=DEBUG"
35-
echo "Hibernate:"
36-
echo "logging.level.org.hibernate=error"
37-
echo "Autoconfig:"
38-
echo "logging.level.org.springframework.boot.autoconfigure=DEBUG"
39-
echo "SQL"
40-
echo "logging.level.sql=DEBUG"
41-
echo "logging:"
42-
echo " level:"
43-
echo " org: "
44-
echo " springframework: "
45-
echo " test: "
46-
echo " context:"
47-
echo " jdbc: DEBUG"
48-
echo " jdbc:"
49-
echo " datasource:"
50-
echo " init: DEBUG"
51-
echo "JPA SQL:"
52-
echo "spring.jpa.show-sql=true"
53-
echo "With Actuator:"
54-
echo "management.endpoints.web.exposure.include=mappings"
55-
echo "http://localhost:8080/actuator/mappings"
56-
}
4+
echo "Usefull stuff to remember:"
5+
echo
6+
echo "Printout mappings at application start:"
7+
echo -e " \n
8+
@EventListener \n
9+
public void handleContextRefresh(ContextRefreshedEvent event) { \n
10+
ApplicationContext applicationContext = event.getApplicationContext(); \n
11+
RequestMappingHandlerMapping requestMappingHandlerMapping = applicationContext \n
12+
.getBean("requestMappingHandlerMapping", RequestMappingHandlerMapping.class); \n
13+
Map<RequestMappingInfo, HandlerMethod> map = requestMappingHandlerMapping \n
14+
.getHandlerMethods(); \n
15+
map.forEach((key, value) -> log.info("{} {}", key, value)); \n
16+
}"
17+
}
5718

5819
showProperties() {
5920
selectItem "find ./src -type f -name 'application*.*'" "awk '{print \$1}'"
@@ -70,11 +31,21 @@ mvnCleanEclipse(){
7031
startSpringBoot() {
7132
echo "Which profile?"
7233
read defprofiles
73-
my_array=("logging.level.web=DEBUG" \
34+
my_array=("logging.level.root=DEBUG" \
35+
"logging.level.web=DEBUG" \
7436
"logging.level.sql=DEBUG" \
7537
"logging.level.web=TRACE" \
7638
"logging.level.sql=TRACE" \
77-
"spring.jpa.show-sql=true")
39+
"spring.jpa.show-sql=true" \
40+
"logging.level.org.springframework=DEBUG" \
41+
"management.endpoints.web.exposure.include=mappings" \
42+
"logging.group.tomcat=org.apache.catalina,org.apache.coyote,org.apache.tomcat,--logging.level.tomcat=DEBUG" \
43+
"logging.level.org.hibernate=DEBUG" \
44+
"logging.level.org.springframework.boot.autoconfigure=DEBUG" \
45+
"logging.level.org.springframework.test.context.jdbc=DEBUG" \
46+
"logging.level.org.springframework.jdbc.datasource.init=DEBUG" \
47+
"spring.jpa.hibernate.ddl-auto=validate" \
48+
"spring.jpa.properties.hibernate.generate_statistics=true,--logging.level.org.hibernate.stat=DEBUG,--spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS=1,--logging.level.org.hibernate.SQL=DEBUG,--logging.level.org.hibernate.cache=DEBUG")
7849
concatenated=$(printf "%s\n" "${my_array[@]}")
7950
selectItem 'printf "%s\n" "${my_array[@]}"' "awk '{print \$1}'"
8051
if [[ $fname == "" ]]; then return 0; fi

EasyKey.maven/maven.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ menuInit "Super MAVEN Home"
2323
menuItemClm I "Clean install" "mvn clean install -DskipTests" P "Clean package" "mvn clean package -DskipTests"
2424
menuItem D "Clean deploy" "mvn clean deploy -DskipTests"
2525
submenuHead "Spring-Boot:"
26-
menuItemClm o "Start Spring Boot App" startSpringBoot r "Enable logging" enableLogging
27-
menuItemClm s "View application properties" showProperties v "Usefull notes" useFull
28-
startMenu
26+
menuItemClm o "Start Spring Boot App" startSpringBoot s "View application properties" showProperties
27+
menuItem v "Usefull notes" useFull
28+
startMenu "$(pwd)"

shellmenu.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,17 @@ menuItemClm () {
112112
#################################################
113113
# The entry method to display the menu in non
114114
# immediate mode (the default mode)
115+
# Arguments:
116+
# $1: a custom output at the bottom of menu
117+
# (e.g. current directory)
115118
# Outputs:
116119
# the menu written to stdout
117120
#################################################
118121
startMenu() {
119122
while ${continuemenu:=true}; do
120123
clear
121124
generateMenu
122-
choice
125+
choice "$1"
123126
done
124127
}
125128

@@ -474,6 +477,10 @@ terminate () { continuemenu=false; }
474477
# and initiates execution of command selected
475478
#################################################
476479
choice () {
480+
if [ -n "$1" ]; then
481+
echo
482+
importantLog "$1"
483+
fi
477484
echo
478485
echo "Press 'q' to quit"
479486
echo

simplest_example.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
########################
4+
# Simplest example #
5+
########################
6+
7+
source "./shellmenu.sh"
8+
9+
clear
10+
menuItem c "Clean all" "mvn clean:clean"
11+
menuItem x "Compile" "mvn clean compile"
12+
menuItem t "Test" "mvn clean test"
13+
menuItem i "Install" "mvn clean install"
14+
startMenu
15+
echo "bye, bye, homie!"

0 commit comments

Comments
 (0)