|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +useFull() { |
| 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 | + } |
| 18 | + |
| 19 | +showProperties() { |
| 20 | + selectItem "find ./src -type f -name 'application*.*'" "awk '{print \$1}'" |
| 21 | + if [[ $fname == "" ]]; then return 0; fi |
| 22 | + vim "$fname" |
| 23 | +} |
| 24 | + |
| 25 | +mvnCleanEclipse(){ |
| 26 | + mvn clean:clean |
| 27 | + mvn eclipse:clean |
| 28 | + mvn eclipse:eclipse |
| 29 | +} |
| 30 | + |
| 31 | +startSpringBoot() { |
| 32 | + echo "Which profile?" |
| 33 | + read defprofiles |
| 34 | + my_array=("logging.level.root=DEBUG" \ |
| 35 | + "logging.level.web=DEBUG" \ |
| 36 | + "logging.level.sql=DEBUG" \ |
| 37 | + "logging.level.web=TRACE" \ |
| 38 | + "logging.level.sql=TRACE" \ |
| 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") |
| 49 | + concatenated=$(printf "%s\n" "${my_array[@]}") |
| 50 | + selectItem 'printf "%s\n" "${my_array[@]}"' "awk '{print \$1}'" |
| 51 | + if [[ $fname == "" ]]; then return 0; fi |
| 52 | + executeCommand "SPRING_PROFILES_ACTIVE="$defprofiles" mvn spring-boot:run -Dspring-boot.run.arguments=--"$fname"" |
| 53 | +} |
| 54 | + |
| 55 | +showGlobalSettings(){ |
| 56 | + OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading global settings from')" |
| 57 | + echo ${OUTPUT:37} |
| 58 | + read -p "Open global settings? " -n 1 -r |
| 59 | + echo # (optional) move to a new line |
| 60 | + if [[ $REPLY =~ ^[Yy]$ ]] |
| 61 | + then |
| 62 | + vim ${OUTPUT:37} |
| 63 | + fi |
| 64 | +} |
| 65 | + |
| 66 | +showLocalSettings() { |
| 67 | + OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading user settings from')" |
| 68 | + echo ${OUTPUT:35} |
| 69 | + read -p "Open user settings? " -n 1 -r |
| 70 | + echo # (optional) move to a new line |
| 71 | + if [[ $REPLY =~ ^[Yy]$ ]] |
| 72 | + then |
| 73 | + vim ${OUTPUT:35} |
| 74 | + fi |
| 75 | +} |
| 76 | + |
| 77 | +downLoadSources() { |
| 78 | + mvn dependency:sources |
| 79 | + mvn eclipse:eclipse -DdownloadSources=true |
| 80 | +} |
| 81 | + |
| 82 | +toRepo() { |
| 83 | + repo=$(mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]') |
| 84 | + cd "$repo" |
| 85 | + echo "Now in: $(pwd)" |
| 86 | + exit |
| 87 | +} |
| 88 | + |
| 89 | +newProject() { |
| 90 | + echo "Command expects the user to be in the new cloned repo folder. <taste drücken>" |
| 91 | + read |
| 92 | + echo "Project name?" |
| 93 | + read projektname |
| 94 | + mvn archetype:generate -DartifactId=$projektname \ |
| 95 | + -DinteractiveMode=true |
| 96 | + mv $projektname/* . |
| 97 | + rm -rf $projektname/ |
| 98 | + mvn compile |
| 99 | + mvn eclipse:eclipse |
| 100 | + git status > .gitignore |
| 101 | + vim .gitignore |
| 102 | + break |
| 103 | +} |
0 commit comments