springboot tomcat8 duplicate springSecurityFilterChain and increasing the maximum size of the cache

本文探讨了Spring Boot项目中使用Spring Security时遇到的配置冲突问题,具体表现为无法同时配置'AbstractSecurityWebApplicationInitializer'类和'@EnableWebSecurity'注解。文章还提供了关于如何调整Tomcat缓存设置来解决问题的方法。

1、springSecurityFilterChain'. Check to ensure the Filter is only configured once.

在pringboot中不能同时存在

public class MessageSecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}

和 @EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter{ 类


to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

在tomcat的context.xml中增加Resources cachingAllowed

    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
    <Resources
        cachingAllowed="true"
        cacheMaxSize="100000"
   />

To solve the problem that the size of one row is 64063 and must be less than 64000, several strategies can be considered: ### Data Compression - **Lossless Compression**: Use algorithms like gzip, deflate, or LZ77 - based methods. These algorithms can reduce the size of the data without losing any information. For example, in Python, you can use the `zlib` library for gzip - like compression: ```python import zlib data = b'your row data here' compressed_data = zlib.compress(data) ``` - **Lossy Compression**: If the data allows for some loss of information, you can use lossy compression techniques. For image data, JPEG compression can be used; for audio, MP3 compression. However, this approach needs to be carefully evaluated based on the nature of the data and the requirements of the application. ### Data Trimming - **Remove Redundant Information**: Look for any redundant or duplicate data within the row. For example, if there are repeated strings or values, you can use data deduplication techniques. In a database, you can use SQL functions to identify and remove duplicates. ```sql -- Example in SQL to remove duplicate rows in a table DELETE FROM your_table WHERE id NOT IN ( SELECT MIN(id) FROM your_table GROUP BY column1, column2, ... ); ``` - **Shorten Strings**: If the row contains long strings, you can try to shorten them. For example, you can use abbreviations or truncate strings if it doesn't affect the essential meaning. ### Data Partitioning - **Split the Row**: Instead of keeping all the data in one row, split it into multiple rows. You can use a unique identifier to link these rows together. For example, if you are dealing with a table in a database, you can create a new table and move some of the columns to it. ```sql -- Create a new table CREATE TABLE new_table ( id INT, new_column1 VARCHAR(255), new_column2 VARCHAR(255), FOREIGN KEY (id) REFERENCES original_table(id) ); -- Move data to the new table INSERT INTO new_table (id, new_column1, new_column2) SELECT id, column3, column4 FROM original_table; -- Remove the columns from the original table ALTER TABLE original_table DROP COLUMN column3, DROP COLUMN column4; ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值