update latest gradle & spring;

fix new spring package dependencies
This commit is contained in:
2023-04-18 09:58:52 +08:00
parent b099d42883
commit 230ceea0fa
11 changed files with 30 additions and 40 deletions

View File

@@ -1,12 +1,13 @@
buildscript {
ext {
kotlin_version = '1.6.10'
spring_version = "2.7.0"
kotlin_version = '1.8.20'
spring_version = "3.0.5"
}
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
@@ -22,14 +23,16 @@ subprojects {
buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
}
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
@@ -44,16 +47,6 @@ subprojects {
testApi group: 'junit', name: 'junit', version: '4.12'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
publishing {
// repositories {
// maven {

View File

@@ -1,5 +1,5 @@
#Mon May 18 17:21:26 CST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists

View File

@@ -3,14 +3,14 @@ package com.synebula.gaea.app.security
import com.synebula.gaea.app.security.session.UserSessionManager
import com.synebula.gaea.data.message.HttpMessageFactory
import com.synebula.gaea.data.message.Status
import jakarta.servlet.FilterChain
import jakarta.servlet.ServletException
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.web.filter.OncePerRequestFilter
import java.io.IOException
import javax.servlet.FilterChain
import javax.servlet.ServletException
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
/**
@@ -64,4 +64,5 @@ class WebAuthorization(
response.flushBuffer()
}
}
}

View File

@@ -40,7 +40,7 @@ class WebSecurity {
// 设置Session的创建策略为Spring Security永不创建HttpSession 不使用HttpSession来获取SecurityContext
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
// 除了登录接口其他资源都必须登录访问
.and().authorizeRequests().antMatchers(this.signInPath).permitAll().anyRequest().authenticated()
.and().authorizeHttpRequests().requestMatchers(this.signInPath).permitAll().anyRequest().authenticated()
// 添加鉴权拦截器
.and().addFilterBefore(
WebAuthorization(httpMessageFactory, userSessionManager),
@@ -62,7 +62,7 @@ class WebSecurity {
@Bean
@Throws(Exception::class)
fun ignoringCustomizer(): WebSecurityCustomizer {
return WebSecurityCustomizer { web -> web.ignoring().antMatchers(this.signInPath) }
return WebSecurityCustomizer { web -> web.ignoring().requestMatchers(this.signInPath) }
}
/**

View File

@@ -3,8 +3,8 @@ package com.synebula.gaea.jpa
import com.synebula.gaea.query.IQuery
import com.synebula.gaea.query.Page
import com.synebula.gaea.query.Params
import jakarta.persistence.EntityManager
import org.springframework.data.jpa.repository.support.SimpleJpaRepository
import javax.persistence.EntityManager
class JpaQuery<TView, ID>(override var clazz: Class<TView>, entityManager: EntityManager) : IQuery<TView, ID> {
protected var repo: SimpleJpaRepository<TView, ID>

View File

@@ -2,13 +2,13 @@ package com.synebula.gaea.jpa
import com.synebula.gaea.domain.model.IAggregateRoot
import com.synebula.gaea.domain.repository.IRepository
import jakarta.persistence.EntityManager
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.support.SimpleJpaRepository
import javax.persistence.EntityManager
class JpaRepository<TAggregateRoot : IAggregateRoot<ID>, ID>(
override var clazz: Class<TAggregateRoot>,
open class JpaRepository<TAggregateRoot : IAggregateRoot<ID>, ID>(
final override var clazz: Class<TAggregateRoot>,
entityManager: EntityManager
) : IRepository<TAggregateRoot, ID> {
protected var repo: JpaRepository<TAggregateRoot, ID>? = null

View File

@@ -3,13 +3,13 @@ package com.synebula.gaea.jpa
import com.synebula.gaea.data.date.DateTime
import com.synebula.gaea.query.Operator
import com.synebula.gaea.query.Where
import jakarta.persistence.criteria.CriteriaBuilder
import jakarta.persistence.criteria.CriteriaQuery
import jakarta.persistence.criteria.Predicate
import jakarta.persistence.criteria.Root
import org.springframework.data.jpa.domain.Specification
import java.lang.reflect.Field
import java.util.*
import javax.persistence.criteria.CriteriaBuilder
import javax.persistence.criteria.CriteriaQuery
import javax.persistence.criteria.Predicate
import javax.persistence.criteria.Root
/**
@@ -137,7 +137,7 @@ fun Map<String, String>?.toSpecification(clazz: Class<*>): Specification<*> {
predicates.add(predicate)
} catch (e: NoSuchFieldException) {
throw Error(
"class [${field.declaringClass.name}] field [${field.name}] can't annotation [@Where(${operator.declaringClass.simpleName}.${operator.name})]",
"class [${field.declaringClass.name}] field [${field.name}] can't annotation [@Where(${operator.declaringJavaClass.simpleName}.${operator.name})]",
e
)
}

View File

@@ -1,6 +1,7 @@
package com.synebula.gaea.jpa.proxy
import com.synebula.gaea.jpa.proxy.method.JpaMethodProxy
import jakarta.persistence.EntityManager
import javassist.*
import javassist.bytecode.AnnotationsAttribute
import javassist.bytecode.MethodInfo
@@ -24,7 +25,6 @@ import org.springframework.data.repository.Repository
import java.lang.reflect.Method
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import javax.persistence.EntityManager
class JpaRepositoryProxy<T : Repository<S, ID>?, S, ID>(
beanFactory: BeanFactory,

View File

@@ -3,13 +3,13 @@ package com.synebula.gaea.jpa.proxy.method.resolver
import com.synebula.gaea.jpa.toSpecification
import com.synebula.gaea.query.Order
import com.synebula.gaea.query.Params
import jakarta.persistence.EmbeddedId
import jakarta.persistence.Id
import org.springframework.data.domain.Page
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Pageable
import org.springframework.data.domain.Sort
import java.util.*
import javax.persistence.EmbeddedId
import javax.persistence.Id
/**
* 分页方法参数映射

View File

@@ -7,7 +7,6 @@ import com.synebula.gaea.domain.event.AfterRemoveEvent
import com.synebula.gaea.domain.event.BeforeRemoveEvent
import com.synebula.gaea.domain.model.IAggregateRoot
import com.synebula.gaea.domain.repository.IRepository
import javax.annotation.Resource
/**
@@ -25,9 +24,8 @@ open class Service<TRoot : IAggregateRoot<ID>, ID>(
protected open var clazz: Class<TRoot>,
protected open var repository: IRepository<TRoot, ID>,
protected open var mapper: IObjectMapper,
) : IService<ID> {
@Resource
protected open var bus: IBus<Any>? = null
) : IService<ID> {
/**
* 增加对象

View File

@@ -7,7 +7,6 @@ import com.synebula.gaea.domain.event.BeforeRemoveEvent
import com.synebula.gaea.domain.model.IAggregateRoot
import com.synebula.gaea.domain.repository.IRepository
import com.synebula.gaea.log.ILogger
import javax.annotation.Resource
/**
@@ -25,9 +24,8 @@ open class SimpleService<TRoot : IAggregateRoot<ID>, ID>(
protected open var clazz: Class<TRoot>,
protected open var repository: IRepository<TRoot, ID>,
override var logger: ILogger,
) : ISimpleService<TRoot, ID> {
@Resource
protected open var bus: IBus<Any>? = null
) : ISimpleService<TRoot, ID> {
override fun add(root: TRoot): DataMessage<ID> {
val msg = DataMessage<ID>()