Spring Boot 2.0.2

This commit is contained in:
Vitaly Takmazov 2018-05-10 09:49:55 +03:00
parent eef3d052fe
commit f28b196898
6 changed files with 24 additions and 16 deletions

View File

@ -1,6 +1,6 @@
buildscript {
ext {
springBootVersion = '1.5.6.RELEASE'
springBootVersion = '2.0.2.RELEASE'
}
repositories {
mavenCentral()
@ -14,6 +14,14 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
}
applyMavenExclusions = false
}
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
@ -33,17 +41,17 @@ dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.flywaydb:flyway-core')
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0')
compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2')
compile('org.springframework.boot:spring-boot-starter-web')
compile('io.jsonwebtoken:jjwt:0.7.0')
compile('io.jsonwebtoken:jjwt:0.9.0')
compile('org.springframework.boot:spring-boot-starter-security')
compile('joda-time:joda-time:2.9.9')
compileOnly('org.projectlombok:lombok')
runtime('com.h2database:h2')
testCompile 'io.rest-assured:rest-assured:3.0.2'
testCompile 'io.rest-assured:spring-mock-mvc:3.0.2'
testCompile 'org.springframework.security:spring-security-test:4.0.4.RELEASE'
testCompile 'io.rest-assured:rest-assured:3.1.0'
testCompile 'io.rest-assured:spring-mock-mvc:3.1.0'
testCompile 'org.springframework.security:spring-security-test'
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
testCompile('org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.0')
testCompile('org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.2')
}

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Mon Aug 07 11:04:20 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip

6
gradlew vendored
View File

@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -155,7 +155,7 @@ if $cygwin ; then
fi
# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}

View File

@ -2,10 +2,10 @@ package io.spring.api.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CORSConfig extends WebMvcConfigurerAdapter {
public class CORSConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")

View File

@ -1,14 +1,15 @@
package io.spring.api.security;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.security.Http401AuthenticationEntryPoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.authentication.HttpStatusEntryPoint;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
@ -40,7 +41,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.csrf().disable()
.cors()
.and()
.exceptionHandling().authenticationEntryPoint(new Http401AuthenticationEntryPoint("Unauthenticated"))
.exceptionHandling().authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))
.and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()