Przeglądaj źródła

Update Spring Boot to 1.5.10

Matt Raible 6 lat temu
rodzic
commit
a940d35a1f

BIN
server/.mvn/wrapper/maven-wrapper.jar Wyświetl plik


+ 1
- 1
server/.mvn/wrapper/maven-wrapper.properties Wyświetl plik

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 Wyświetl plik

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 Wyświetl plik

54
   CYGWIN*) cygwin=true ;;
54
   CYGWIN*) cygwin=true ;;
55
   MINGW*) mingw=true;;
55
   MINGW*) mingw=true;;
56
   Darwin*) darwin=true
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
 esac
67
 esac
90
 
68
 
91
 if [ -z "$JAVA_HOME" ] ; then
69
 if [ -z "$JAVA_HOME" ] ; then
184
 
162
 
185
 CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
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
 # traverses directory structure from process work directory to filesystem root
165
 # traverses directory structure from process work directory to filesystem root
198
 # first directory with .mvn subdirectory is considered project base directory
166
 # first directory with .mvn subdirectory is considered project base directory
199
 find_maven_basedir() {
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
   while [ "$wdir" != '/' ] ; do
177
   while [ "$wdir" != '/' ] ; do
203
     if [ -d "$wdir"/.mvn ] ; then
178
     if [ -d "$wdir"/.mvn ] ; then
204
       basedir=$wdir
179
       basedir=$wdir
205
       break
180
       break
206
     fi
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
   done
187
   done
209
   echo "${basedir}"
188
   echo "${basedir}"
210
 }
189
 }
216
   fi
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
 MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
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
 WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
219
 WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
228
 
220
 
230
   $MAVEN_OPTS \
222
   $MAVEN_OPTS \
231
   -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
223
   -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
224
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233
-  ${WRAPPER_LAUNCHER} "$@"
225
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 3
- 5
server/mvnw.cmd Wyświetl plik

80
 
80
 
81
 :init
81
 :init
82
 
82
 
83
-set MAVEN_CMD_LINE_ARGS=%*
84
-
85
 @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
83
 @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86
 @REM Fallback to current working directory if not found.
84
 @REM Fallback to current working directory if not found.
87
 
85
 
118
 
116
 
119
 SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
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
 set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
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
 if ERRORLEVEL 1 goto error
123
 if ERRORLEVEL 1 goto error
126
 goto end
124
 goto end
127
 
125
 
142
 
140
 
143
 if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
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 Wyświetl plik

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

+ 0
- 29
server/src/main/java/com/example/DemoApplication.java Wyświetl plik

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 Wyświetl plik

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 Wyświetl plik

1
-package com.example.beer;
1
+package com.example.demo.beer;
2
 
2
 
3
 import javax.persistence.Entity;
3
 import javax.persistence.Entity;
4
 import javax.persistence.GeneratedValue;
4
 import javax.persistence.GeneratedValue;
42
                 ", name='" + name + '\'' +
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 Wyświetl plik

1
-package com.example.beer;
1
+package com.example.demo.beer;
2
 
2
 
3
 import org.springframework.boot.CommandLineRunner;
3
 import org.springframework.boot.CommandLineRunner;
4
 import org.springframework.stereotype.Component;
4
 import org.springframework.stereotype.Component;
6
 import java.util.stream.Stream;
6
 import java.util.stream.Stream;
7
 
7
 
8
 @Component
8
 @Component
9
-class BeerCommandLineRunner implements CommandLineRunner {
9
+public class BeerCommandLineRunner implements CommandLineRunner {
10
+
10
     private final BeerRepository repository;
11
     private final BeerRepository repository;
11
 
12
 
12
     public BeerCommandLineRunner(BeerRepository repository) {
13
     public BeerCommandLineRunner(BeerRepository repository) {
22
         );
23
         );
23
         repository.findAll().forEach(System.out::println);
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 Wyświetl plik

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

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

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