Bläddra i källkod

Update Spring Boot to 1.5.10

Matt Raible 6 år sedan
förälder
incheckning
a940d35a1f

Binär
server/.mvn/wrapper/maven-wrapper.jar Visa fil


+ 1
- 1
server/.mvn/wrapper/maven-wrapper.properties Visa fil

@@ -1 +1 @@
1
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
1
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip

+ 0
- 15
server/README.md Visa fil

@@ -1,15 +0,0 @@
1
-## Spring Boot with Stormpath
2
-
3
-If you already have Stormpath configured, you should be able to start this app with `mvn spring-boot:run`. 
4
-
5
-See instructions below if you don't have a Stormpath account.
6
-
7
-## Stormpath Setup
8
-
9
-The [Stormpath Spring Boot Quickstart](https://docs.stormpath.com/java/spring-boot-web/quickstart.html) shows how to create a Stormpath account and download an API key; here’s the abridged version:
10
-
11
-1. Signup for a free Stormpath developer account at https://api.stormpath.com/register.
12
-2. From the Home tab of the Admin Console select Manage API Keys under the Developer Tools heading.
13
-3. Click the Create API Key button to trigger a download of a apiKey-{API_KEY}.properties file.
14
-4. Move the file to `~/.stormpath/apiKey.properties`.
15
-

+ 43
- 51
server/mvnw Visa fil

@@ -54,38 +54,16 @@ case "`uname`" in
54 54
   CYGWIN*) cygwin=true ;;
55 55
   MINGW*) mingw=true;;
56 56
   Darwin*) darwin=true
57
-           #
58
-           # Look for the Apple JDKs first to preserve the existing behaviour, and then look
59
-           # for the new JDKs provided by Oracle.
60
-           #
61
-           if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
62
-             #
63
-             # Apple JDKs
64
-             #
65
-             export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
66
-           fi
67
-
68
-           if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
69
-             #
70
-             # Apple JDKs
71
-             #
72
-             export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
73
-           fi
74
-
75
-           if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
76
-             #
77
-             # Oracle JDKs
78
-             #
79
-             export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
80
-           fi
81
-
82
-           if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
83
-             #
84
-             # Apple JDKs
85
-             #
86
-             export JAVA_HOME=`/usr/libexec/java_home`
87
-           fi
88
-           ;;
57
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+    if [ -z "$JAVA_HOME" ]; then
60
+      if [ -x "/usr/libexec/java_home" ]; then
61
+        export JAVA_HOME="`/usr/libexec/java_home`"
62
+      else
63
+        export JAVA_HOME="/Library/Java/Home"
64
+      fi
65
+    fi
66
+    ;;
89 67
 esac
90 68
 
91 69
 if [ -z "$JAVA_HOME" ] ; then
@@ -184,27 +162,28 @@ fi
184 162
 
185 163
 CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
186 164
 
187
-# For Cygwin, switch paths to Windows format before running java
188
-if $cygwin; then
189
-  [ -n "$M2_HOME" ] &&
190
-    M2_HOME=`cygpath --path --windows "$M2_HOME"`
191
-  [ -n "$JAVA_HOME" ] &&
192
-    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
193
-  [ -n "$CLASSPATH" ] &&
194
-    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
195
-fi
196
-
197 165
 # traverses directory structure from process work directory to filesystem root
198 166
 # first directory with .mvn subdirectory is considered project base directory
199 167
 find_maven_basedir() {
200
-  local basedir=$(pwd)
201
-  local wdir=$(pwd)
168
+
169
+  if [ -z "$1" ]
170
+  then
171
+    echo "Path not specified to find_maven_basedir"
172
+    return 1
173
+  fi
174
+
175
+  basedir="$1"
176
+  wdir="$1"
202 177
   while [ "$wdir" != '/' ] ; do
203 178
     if [ -d "$wdir"/.mvn ] ; then
204 179
       basedir=$wdir
205 180
       break
206 181
     fi
207
-    wdir=$(cd "$wdir/.."; pwd)
182
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183
+    if [ -d "${wdir}" ]; then
184
+      wdir=`cd "$wdir/.."; pwd`
185
+    fi
186
+    # end of workaround
208 187
   done
209 188
   echo "${basedir}"
210 189
 }
@@ -216,13 +195,26 @@ concat_lines() {
216 195
   fi
217 196
 }
218 197
 
219
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
198
+BASE_DIR=`find_maven_basedir "$(pwd)"`
199
+if [ -z "$BASE_DIR" ]; then
200
+  exit 1;
201
+fi
202
+
203
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204
+echo $MAVEN_PROJECTBASEDIR
220 205
 MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
221 206
 
222
-# Provide a "standardized" way to retrieve the CLI args that will
223
-# work with both Windows and non-Windows executions.
224
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
225
-export MAVEN_CMD_LINE_ARGS
207
+# For Cygwin, switch paths to Windows format before running java
208
+if $cygwin; then
209
+  [ -n "$M2_HOME" ] &&
210
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
211
+  [ -n "$JAVA_HOME" ] &&
212
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
213
+  [ -n "$CLASSPATH" ] &&
214
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
215
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
216
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
217
+fi
226 218
 
227 219
 WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
228 220
 
@@ -230,4 +222,4 @@ exec "$JAVACMD" \
230 222
   $MAVEN_OPTS \
231 223
   -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232 224
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233
-  ${WRAPPER_LAUNCHER} "$@"
225
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 3
- 5
server/mvnw.cmd Visa fil

@@ -80,8 +80,6 @@ goto error
80 80
 
81 81
 :init
82 82
 
83
-set MAVEN_CMD_LINE_ARGS=%*
84
-
85 83
 @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 84
 @REM Fallback to current working directory if not found.
87 85
 
@@ -118,10 +116,10 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
118 116
 
119 117
 SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 118
 
121
-set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
119
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
122 120
 set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
123 121
 
124
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
122
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
125 123
 if ERRORLEVEL 1 goto error
126 124
 goto end
127 125
 
@@ -142,4 +140,4 @@ if "%MAVEN_BATCH_PAUSE%" == "on" pause
142 140
 
143 141
 if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
144 142
 
145
-exit /B %ERROR_CODE%
143
+exit /B %ERROR_CODE%

+ 2
- 2
server/pom.xml Visa fil

@@ -14,7 +14,7 @@
14 14
     <parent>
15 15
         <groupId>org.springframework.boot</groupId>
16 16
         <artifactId>spring-boot-starter-parent</artifactId>
17
-        <version>1.5.3.RELEASE</version>
17
+        <version>1.5.10.RELEASE</version>
18 18
         <relativePath/> <!-- lookup parent from repository -->
19 19
     </parent>
20 20
 
@@ -37,6 +37,7 @@
37 37
             <groupId>org.springframework.boot</groupId>
38 38
             <artifactId>spring-boot-starter-web</artifactId>
39 39
         </dependency>
40
+
40 41
         <dependency>
41 42
             <groupId>org.springframework.boot</groupId>
42 43
             <artifactId>spring-boot-devtools</artifactId>
@@ -63,5 +64,4 @@
63 64
             </plugin>
64 65
         </plugins>
65 66
     </build>
66
-
67 67
 </project>

+ 0
- 29
server/src/main/java/com/example/DemoApplication.java Visa fil

@@ -1,29 +0,0 @@
1
-package com.example;
2
-
3
-import org.springframework.boot.CommandLineRunner;
4
-import org.springframework.boot.SpringApplication;
5
-import org.springframework.boot.autoconfigure.SpringBootApplication;
6
-import org.springframework.data.jpa.repository.JpaRepository;
7
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
8
-import org.springframework.stereotype.Component;
9
-import org.springframework.web.bind.annotation.GetMapping;
10
-import org.springframework.web.bind.annotation.RestController;
11
-
12
-import javax.persistence.Entity;
13
-import javax.persistence.GeneratedValue;
14
-import javax.persistence.Id;
15
-import java.util.Collection;
16
-import java.util.HashMap;
17
-import java.util.Map;
18
-import java.util.stream.Collectors;
19
-import java.util.stream.Stream;
20
-
21
-@SpringBootApplication
22
-public class DemoApplication {
23
-
24
-    public static void main(String[] args) {
25
-        SpringApplication.run(DemoApplication.class, args);
26
-    }
27
-}
28
-
29
-

+ 12
- 0
server/src/main/java/com/example/demo/DemoApplication.java Visa fil

@@ -0,0 +1,12 @@
1
+package com.example.demo;
2
+
3
+import org.springframework.boot.SpringApplication;
4
+import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+
6
+@SpringBootApplication
7
+public class DemoApplication {
8
+
9
+    public static void main(String[] args) {
10
+        SpringApplication.run(DemoApplication.class, args);
11
+    }
12
+}

server/src/main/java/com/example/beer/Beer.java → server/src/main/java/com/example/demo/beer/Beer.java Visa fil

@@ -1,4 +1,4 @@
1
-package com.example.beer;
1
+package com.example.demo.beer;
2 2
 
3 3
 import javax.persistence.Entity;
4 4
 import javax.persistence.GeneratedValue;
@@ -42,4 +42,4 @@ public class Beer {
42 42
                 ", name='" + name + '\'' +
43 43
                 '}';
44 44
     }
45
-}
45
+}

server/src/main/java/com/example/beer/BeerCommandLineRunner.java → server/src/main/java/com/example/demo/beer/BeerCommandLineRunner.java Visa fil

@@ -1,4 +1,4 @@
1
-package com.example.beer;
1
+package com.example.demo.beer;
2 2
 
3 3
 import org.springframework.boot.CommandLineRunner;
4 4
 import org.springframework.stereotype.Component;
@@ -6,7 +6,8 @@ import org.springframework.stereotype.Component;
6 6
 import java.util.stream.Stream;
7 7
 
8 8
 @Component
9
-class BeerCommandLineRunner implements CommandLineRunner {
9
+public class BeerCommandLineRunner implements CommandLineRunner {
10
+
10 11
     private final BeerRepository repository;
11 12
 
12 13
     public BeerCommandLineRunner(BeerRepository repository) {
@@ -22,4 +23,4 @@ class BeerCommandLineRunner implements CommandLineRunner {
22 23
         );
23 24
         repository.findAll().forEach(System.out::println);
24 25
     }
25
-}
26
+}

server/src/main/java/com/example/beer/BeerController.java → server/src/main/java/com/example/demo/beer/BeerController.java Visa fil

@@ -1,4 +1,4 @@
1
-package com.example.beer;
1
+package com.example.demo.beer;
2 2
 
3 3
 import org.springframework.web.bind.annotation.CrossOrigin;
4 4
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,7 +16,7 @@ public class BeerController {
16 16
     }
17 17
 
18 18
     @GetMapping("/good-beers")
19
-    @CrossOrigin(origins = {"http://localhost:8100","file://"})
19
+    @CrossOrigin(origins = "http://localhost:4200")
20 20
     public Collection<Beer> goodBeers() {
21 21
 
22 22
         return repository.findAll().stream()
@@ -29,4 +29,4 @@ public class BeerController {
29 29
                 !beer.getName().equals("Coors Light") &&
30 30
                 !beer.getName().equals("PBR");
31 31
     }
32
-}
32
+}

server/src/main/java/com/example/beer/BeerRepository.java → server/src/main/java/com/example/demo/beer/BeerRepository.java Visa fil

@@ -1,10 +1,8 @@
1
-package com.example.beer;
1
+package com.example.demo.beer;
2 2
 
3 3
 import org.springframework.data.jpa.repository.JpaRepository;
4 4
 import org.springframework.data.rest.core.annotation.RepositoryRestResource;
5
-import org.springframework.web.bind.annotation.CrossOrigin;
6 5
 
7 6
 @RepositoryRestResource
8
-@CrossOrigin(origins = {"http://localhost:8100","file://"})
9 7
 interface BeerRepository extends JpaRepository<Beer, Long> {
10
-}
8
+}

server/src/test/java/com/example/DemoApplicationTests.java → server/src/test/java/com/example/demo/DemoApplicationTests.java Visa fil

@@ -1,4 +1,4 @@
1
-package com.example;
1
+package com.example.demo;
2 2
 
3 3
 import org.junit.Test;
4 4
 import org.junit.runner.RunWith;