mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 12:05:28 +08:00
spring3
This commit is contained in:
@ -19,13 +19,19 @@
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-properties-migrator</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!--安全模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -2,8 +2,9 @@ package org.jeecg.monitor.config;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.Customizer;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
|
||||
|
||||
@ -11,7 +12,7 @@ import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
|
||||
* @author scott
|
||||
*/
|
||||
@Configuration
|
||||
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
|
||||
public class SecuritySecureConfig {
|
||||
|
||||
private final String adminContextPath;
|
||||
|
||||
@ -20,32 +21,40 @@ public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
public SecurityFilterChain configure(HttpSecurity http) throws Exception {
|
||||
// 登录成功处理类
|
||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
||||
successHandler.setTargetUrlParameter("redirectTo");
|
||||
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
||||
|
||||
http.authorizeRequests()
|
||||
//静态文件允许访问
|
||||
.antMatchers(adminContextPath + "/assets/**").permitAll()
|
||||
//登录页面允许访问
|
||||
.antMatchers(adminContextPath + "/login", "/css/**", "/js/**", "/image/*").permitAll()
|
||||
//其他所有请求需要登录
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
//登录页面配置,用于替换security默认页面
|
||||
.formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
|
||||
//登出页面配置,用于替换security默认页面
|
||||
.logout().logoutUrl(adminContextPath + "/logout").and()
|
||||
.httpBasic().and()
|
||||
.csrf()
|
||||
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
|
||||
.ignoringAntMatchers(
|
||||
"/instances",
|
||||
"/actuator/**"
|
||||
);
|
||||
http.authorizeRequests(authorize -> {
|
||||
try {
|
||||
authorize
|
||||
|
||||
//静态文件允许访问
|
||||
.requestMatchers(adminContextPath + "/assets/**").permitAll()
|
||||
//登录页面允许访问
|
||||
.requestMatchers(adminContextPath + "/login", "/css/**", "/js/**", "/image/*").permitAll()
|
||||
//其他所有请求需要登录
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
//登录页面配置,用于替换security默认页面
|
||||
.formLogin(formLogin -> formLogin.loginPage(adminContextPath + "/login").successHandler(successHandler))
|
||||
//登出页面配置,用于替换security默认页面
|
||||
.logout(logout -> logout.logoutUrl(adminContextPath + "/logout"))
|
||||
.httpBasic(Customizer.withDefaults())
|
||||
.csrf(csrf -> csrf.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
|
||||
.ignoringRequestMatchers(
|
||||
"/instances",
|
||||
"/actuator/**")
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return http.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3,15 +3,20 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>jeecg-visual</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.6.1</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.10</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>jeecg-cloud-sentinel</artifactId>
|
||||
<name>jeecg-cloud-sentinel</name>
|
||||
<description>sentinel启动模块</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.cloud</groupId>
|
||||
<artifactId>sentinel-dashboard</artifactId>
|
||||
|
||||
@ -12,7 +12,7 @@ spring:
|
||||
mvc:
|
||||
#Spring Boot 2.6+\u540E\u6620\u5C04\u5339\u914D\u7684\u9ED8\u8BA4\u7B56\u7565\u5DF2\u4ECEAntPathMatcher\u66F4\u6539\u4E3APathPatternParser,\u9700\u8981\u624B\u52A8\u6307\u5B9A\u4E3Aant-path-matcher
|
||||
pathmatch:
|
||||
matching-strategy: ant-path-matcher
|
||||
matching-strategy: ant_path_matcher
|
||||
#auth settings
|
||||
auth:
|
||||
filter:
|
||||
@ -29,7 +29,7 @@ logging:
|
||||
name: ${user.home}/logs/csp/sentinel-dashboard.log
|
||||
nacos:
|
||||
server:
|
||||
ip: @config.server-addr@
|
||||
ip: localhost:8848
|
||||
sentinel:
|
||||
dashboard:
|
||||
version: 1.8.2
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package org.jeecg.modules.test.feign.controller;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
@ -8,8 +10,6 @@ import org.jeecg.modules.test.feign.client.JeecgTestClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 微服务单元测试
|
||||
@ -19,7 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/test")
|
||||
@Api(tags = "【微服务】单元测试")
|
||||
@Tag(name = "【微服务】单元测试")
|
||||
public class JeecgTestFeignController {
|
||||
|
||||
@Autowired
|
||||
@ -32,7 +32,7 @@ public class JeecgTestFeignController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMessage")
|
||||
@ApiOperation(value = "测试feign调用demo服务1", notes = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@Operation(summary = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@SentinelResource(value = "test_more_getMessage", fallback = "getDefaultUser")
|
||||
public Result<String> getMessage(@RequestParam(value = "name", required = false) String name) {
|
||||
log.info("---------Feign fallbackFactory优先级高于@SentinelResource-----------------");
|
||||
@ -47,7 +47,7 @@ public class JeecgTestFeignController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMessage2")
|
||||
@ApiOperation(value = "测试feign调用demo服务2", notes = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@Operation(summary = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
public Result<String> getMessage2(@RequestParam(value = "name", required = false) String name) {
|
||||
log.info("---------测试 Feign fallbackFactory-----------------");
|
||||
String resultMsg = jeecgTestClient.getMessage(" I am jeecg-system 服务节点,呼叫 jeecg-demo!");
|
||||
@ -56,7 +56,7 @@ public class JeecgTestFeignController {
|
||||
|
||||
|
||||
@GetMapping("/fallback")
|
||||
@ApiOperation(value = "测试熔断", notes = "测试熔断")
|
||||
@Operation(summary = "测试熔断")
|
||||
@SentinelResource(value = "test_more_fallback", fallback = "getDefaultUser")
|
||||
public Result<Object> test(@RequestParam(value = "name", required = false) String name) {
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package org.jeecg.modules.test.rabbitmq.controller;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
@ -13,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/test")
|
||||
@Api(tags = "【微服务】MQ单元测试")
|
||||
@Tag(name = "【微服务】MQ单元测试")
|
||||
public class JeecgMqTestController {
|
||||
|
||||
@Autowired
|
||||
@ -39,7 +39,7 @@ public class JeecgMqTestController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/rabbitmq")
|
||||
@ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq")
|
||||
@Operation(summary = "测试rabbitmq")
|
||||
public Result<?> rabbitMqClientTest(HttpServletRequest req) {
|
||||
//rabbitmq消息队列测试
|
||||
BaseMap map = new BaseMap();
|
||||
@ -50,7 +50,7 @@ public class JeecgMqTestController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/rabbitmq2")
|
||||
@ApiOperation(value = "rabbitmq消息总线测试", notes = "rabbitmq消息总线测试")
|
||||
@Operation(summary = "rabbitmq消息总线测试")
|
||||
public Result<?> rabbitmq2(HttpServletRequest req) {
|
||||
|
||||
//rabbitmq消息总线测试
|
||||
|
||||
@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,15 @@
|
||||
server:
|
||||
port: 5002
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
##redis 单机环境配置
|
||||
host: localhost
|
||||
port: 6379
|
||||
database: 0
|
||||
password:
|
||||
ssl:
|
||||
enabled: false
|
||||
application:
|
||||
name: seata-account
|
||||
main:
|
||||
@ -18,8 +27,13 @@ spring:
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
schema: classpath:sql/schema-account.sql
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
import-check:
|
||||
enabled: false
|
||||
seata:
|
||||
enable-auto-data-source-proxy: false
|
||||
enable-auto-data-source-proxy: true
|
||||
service:
|
||||
grouplist:
|
||||
default: 127.0.0.1:8091
|
||||
|
||||
@ -6,9 +6,9 @@ package org.jeecg.modules.test.seata.order.controller;
|
||||
* @date: 2022/01/24
|
||||
* @version: V1.0
|
||||
*/
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.modules.test.seata.order.dto.PlaceOrderRequest;
|
||||
import org.jeecg.modules.test.seata.order.service.SeataOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/test/seata/order")
|
||||
@Api(tags = "seata测试")
|
||||
@Tag(name = "seata测试")
|
||||
public class SeataOrderController {
|
||||
|
||||
@Autowired
|
||||
@ -30,7 +30,7 @@ public class SeataOrderController {
|
||||
* 自由下单
|
||||
*/
|
||||
@PostMapping("/placeOrder")
|
||||
@ApiOperation(value = "自由下单", notes = "自由下单")
|
||||
@Operation(summary = "自由下单")
|
||||
public String placeOrder(@Validated @RequestBody PlaceOrderRequest request) {
|
||||
orderService.placeOrder(request);
|
||||
return "下单成功";
|
||||
@ -40,7 +40,7 @@ public class SeataOrderController {
|
||||
* 测试商品库存不足-异常回滚
|
||||
*/
|
||||
@PostMapping("/test1")
|
||||
@ApiOperation(value = "测试商品库存不足", notes = "测试商品库存不足")
|
||||
@Operation(summary = "测试商品库存不足")
|
||||
public String test1() {
|
||||
//商品单价10元,库存20个,用户余额50元,模拟一次性购买22个。 期望异常回滚
|
||||
orderService.placeOrder(new PlaceOrderRequest(1L, 1L, 22));
|
||||
@ -51,7 +51,7 @@ public class SeataOrderController {
|
||||
* 测试用户账户余额不足-异常回滚
|
||||
*/
|
||||
@PostMapping("/test2")
|
||||
@ApiOperation(value = "测试用户账户余额不足", notes = "测试用户账户余额不足")
|
||||
@Operation(summary = "测试用户账户余额不足")
|
||||
public String test2() {
|
||||
//商品单价10元,库存20个,用户余额50元,模拟一次性购买6个。 期望异常回滚
|
||||
orderService.placeOrder(new PlaceOrderRequest(1L, 1L, 6));
|
||||
|
||||
@ -4,7 +4,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
/**
|
||||
* @Description: 订单请求对象
|
||||
* @author: zyf
|
||||
|
||||
@ -16,7 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,12 +1,21 @@
|
||||
server:
|
||||
port: 5001
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
##redis 单机环境配置
|
||||
host: localhost
|
||||
port: 6379
|
||||
database: 0
|
||||
password:
|
||||
ssl:
|
||||
enabled: false
|
||||
application:
|
||||
name: seata-order
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: order
|
||||
@ -19,6 +28,11 @@ spring:
|
||||
username: root
|
||||
password: root
|
||||
schema: classpath:sql/schema-order.sql
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
import-check:
|
||||
enabled: false
|
||||
seata:
|
||||
enable-auto-data-source-proxy: false
|
||||
service:
|
||||
|
||||
@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
@ -19,7 +20,7 @@ public class SeataProductController {
|
||||
private SeataProductService seataProductService;
|
||||
|
||||
@PostMapping("/reduceStock")
|
||||
public BigDecimal reduceStock(Long productId, Integer count) {
|
||||
public BigDecimal reduceStock(Long productId, Integer count, HttpServletRequest request) {
|
||||
return seataProductService.reduceStock(productId, count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,15 @@
|
||||
server:
|
||||
port: 5003
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
##redis 单机环境配置
|
||||
host: localhost
|
||||
port: 6379
|
||||
database: 0
|
||||
password:
|
||||
ssl:
|
||||
enabled: false
|
||||
application:
|
||||
name: seata-product
|
||||
main:
|
||||
@ -18,6 +27,11 @@ spring:
|
||||
username: root
|
||||
password: root
|
||||
schema: classpath:sql/schema-product.sql
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
import-check:
|
||||
enabled: false
|
||||
seata:
|
||||
enable-auto-data-source-proxy: false
|
||||
service:
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.jeecg.modules.test.sharding.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
@ -10,8 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "分库分表测试")
|
||||
@Tag(name = "分库分表测试")
|
||||
@RestController
|
||||
@RequestMapping("/sharding")
|
||||
public class JeecgShardingDemoController extends JeecgController<ShardingSysLog, IShardingSysLogService> {
|
||||
@ -33,7 +33,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test1")
|
||||
@ApiOperation(value = "单库分表插入", notes = "单库分表")
|
||||
@Operation(summary = "单库分表")
|
||||
public Result<?> add() {
|
||||
log.info("---------------------------------单库分表插入--------------------------------");
|
||||
int size = 10;
|
||||
@ -52,7 +52,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list1")
|
||||
@ApiOperation(value = "单库分表查询", notes = "单库分表")
|
||||
@Operation(summary = "单库分表")
|
||||
public Result<?> list() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test2")
|
||||
@ApiOperation(value = "分库分表插入", notes = "分库分表")
|
||||
@Operation(summary = "分库分表")
|
||||
public Result<?> test2() {
|
||||
int start=20;
|
||||
int size=30;
|
||||
@ -81,7 +81,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list2")
|
||||
@ApiOperation(value = "分库分表查询", notes = "分库分表")
|
||||
@Operation(summary = "分库分表")
|
||||
public Result<?> list2() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<!-- mysql -->
|
||||
<dependency>
|
||||
|
||||
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@ -12,8 +12,8 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
||||
@ -22,8 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -2,13 +2,13 @@ package com.xxl.job.admin.controller.interceptor;
|
||||
|
||||
import com.xxl.job.admin.core.util.FtlUtil;
|
||||
import com.xxl.job.admin.core.util.I18nUtil;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
@ -17,7 +17,7 @@ import java.util.HashMap;
|
||||
* @author xuxueli 2015-12-12 18:09:04
|
||||
*/
|
||||
@Component
|
||||
public class CookieInterceptor extends HandlerInterceptorAdapter {
|
||||
public class CookieInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
@ -36,8 +36,7 @@ public class CookieInterceptor extends HandlerInterceptorAdapter {
|
||||
if (modelAndView != null) {
|
||||
modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName()));
|
||||
}
|
||||
|
||||
super.postHandle(request, response, handler, modelAndView);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,13 +4,12 @@ import com.xxl.job.admin.controller.annotation.PermissionLimit;
|
||||
import com.xxl.job.admin.core.model.XxlJobUser;
|
||||
import com.xxl.job.admin.core.util.I18nUtil;
|
||||
import com.xxl.job.admin.service.LoginService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
/**
|
||||
* 权限拦截
|
||||
@ -18,7 +17,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author xuxueli 2015-12-12 18:09:04
|
||||
*/
|
||||
@Component
|
||||
public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
public class PermissionInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
@ -27,7 +26,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
if (!(handler instanceof HandlerMethod)) {
|
||||
return super.preHandle(request, response, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
// if need login
|
||||
@ -53,7 +52,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);
|
||||
}
|
||||
|
||||
return super.preHandle(request, response, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
/**
|
||||
* web mvc config
|
||||
|
||||
@ -11,8 +11,8 @@ import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.xxl.job.admin.core.util;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Cookie.Util
|
||||
|
||||
@ -9,9 +9,9 @@ import com.xxl.job.core.biz.model.ReturnT;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
|
||||
@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -17,7 +17,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
Reference in New Issue
Block a user