Skip to content

Commit

Permalink
feat: bump spring boot to v3.0.0 (#81)
Browse files Browse the repository at this point in the history
* feat: bump spring boot to v3.0.0

* fix: bug fix

* fix: update fix

* fix: fix all error

* fix: update bazel

* feat: update bazel

* fix: update shiro to 1.12.0
  • Loading branch information
damingerdai authored Oct 19, 2023
1 parent f920a73 commit 629a6b7
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 30 deletions.
6 changes: 5 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
build --java_language_version=17
build --java_language_version=17

# Load any settings which are specific to the current user. Needs to be *last* statement
# in this config, as the user configuration should be able to overwrite flags from this file.
try-import %workspace%/.bazelrc.user
2 changes: 0 additions & 2 deletions .bazelrc.back

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ jobs:
- name: Build with vite
run: cd ./src/main/react && yarn && yarn build
- name: Build with bazel
run: bazel build //:java-maven
run: bazel build //:jobs
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ logs
bazel-bin
bazel-jobs
bazel-out
bazel-testlogs
bazel-testlogs
.bazelrc.user
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ java_library(
)

java_binary(
name = "java-maven",
name = "jobs",
main_class = "org.daming.jobs.JobsApplication",
runtime_deps = [":java-maven-lib"],
)
Expand Down
61 changes: 51 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,71 @@ load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

# rules_jvm_external_setup()

load("@rules_jvm_external//:specs.bzl", "maven")
load("@rules_jvm_external//:defs.bzl", "maven_install")

# for https://github.com/apache/shiro/issues/891
shiros = [
maven.artifact(
group ="org.apache.shiro",
artifact = "shiro-spring-boot-web-starter",
version = "1.12.0",
# classifier = "jakarta",
),
maven.artifact(
group ="org.apache.shiro",
artifact = "shiro-spring-boot-starter",
version = "1.12.0",
classifier = "jakarta",
),
maven.artifact(
group = "org.apache.shiro",
artifact = "shiro-spring",
version = "1.12.0",
classifier = "jakarta",
exclusions = [
maven.exclusion(
group = "javax.servlet",
artifact = "*",
),
maven.exclusion(
group = "org.apache.shiro",
artifact = "*",
),
]
),
maven.artifact(
group = "org.apache.shiro",
artifact = "shiro-web",
version ="1.12.0",
classifier = "jakarta",
)
]

maven_install(
artifacts = [
"org.springframework.boot:spring-boot-starter-web:2.7.12",
"org.springframework.boot:spring-boot-starter-jdbc:2.7.12",
"org.springframework.boot:spring-boot-starter-quartz:2.7.12",
"org.springframework.boot:spring-boot-starter-aop:2.7.12",
"org.springframework.boot:spring-boot-starter-web:3.0.0",
"org.springframework.boot:spring-boot-starter-jdbc:3.0.0",
"org.springframework.boot:spring-boot-starter-quartz:3.0.0",
"org.springframework.boot:spring-boot-starter-aop:3.0.0",

"io.springfox:springfox-boot-starter:3.0.0",
"org.apache.shiro:shiro-spring-boot-starter:1.9.1",
"com.auth0:java-jwt:3.19.4",
"org.postgresql:postgresql:42.4.0",

"org.springframework.boot:spring-boot-devtools:2.7.12",
"org.springframework.boot:spring-boot-starter-test:2.7.12"
"org.springframework.boot:spring-boot-devtools:3.0.0",
"org.springframework.boot:spring-boot-starter-test:3.0.0"

],
fetch_sources = True,
] + shiros,
fetch_sources = True,
repositories = [
"https://maven.aliyun.com/repository/public/",
"https://maven.aliyun.com/nexus/content/groups/public/",
"http://uk.maven.org/maven2",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
override_targets = {
"javax.servlet:javax.servlet-api": "jakarta.servlet:jakarta.servlet-api",
},
)
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '2.7.12'
id 'org.springframework.boot' version '3.0.0'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.flywaydb.flyway' version '9.19.1'
id 'java'
Expand Down Expand Up @@ -27,7 +27,9 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-quartz'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'org.apache.shiro:shiro-spring-boot-starter:1.9.1'
implementation 'org.apache.shiro:shiro-spring-boot-starter:1.12.0:jakarta'
implementation('org.apache.shiro:shiro-spring:1.12.0:jakarta') { exclude group: 'org.apache.shiro', module: 'shiro-web' }
implementation 'org.apache.shiro:shiro-web:1.12.0:jakarta'

implementation 'com.auth0:java-jwt:3.19.4'
implementation 'org.postgresql:postgresql'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh

#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
Expand All @@ -14,7 +15,6 @@
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/daming/jobs/base/shiro/JWTFilter.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.daming.jobs.base.shiro;

import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.daming.jobs.base.logger.DamingLogger;
import org.daming.jobs.base.logger.LoggerManager;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.daming.jobs.base.shiro;

import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/daming/jobs/base/utils/CommonUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.daming.jobs.base.utils;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/daming/jobs/config/ShiroConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.daming.jobs.config;

import jakarta.servlet.Filter;
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
import org.apache.shiro.mgt.DefaultSubjectDAO;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
Expand All @@ -13,7 +14,6 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

import javax.servlet.Filter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.daming.jobs.pojo.ApiError;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down

0 comments on commit 629a6b7

Please sign in to comment.