升级sts4 ,碰到的坑,maven打jar包,ehcache的内存泄露

之前,在eclipse 2019中,新建springboot项目 pom出错,需要改

<!-- <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> -->

现在这句可以废弃不用了,默认的sts4带的,就可以。

 

在maven打jar包,仍会碰到无法把jsp页面,包进去的情况,,1.4.2的版本,仍需表明。

<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.4.2.RELEASE</version>
                
                <configuration>
                <mainClass>cn.taotao.Zhouyi3Application</mainClass>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <useDefaultDelimiters>true</useDefaultDelimiters>
                </configuration>
            </plugin>
        </plugins>

 


 

在ehcache中,出现大量的驻留内存。

使用这个方法,测试去掉ehcache的内存泄露

@Configuration
public class EhcacheListenerConfig {

    @Bean
    public IntrospectorCleanupListener introspectorCleanupListener() {
        return new IntrospectorCleanupListener();
    }
    
    @Bean
    public ServletListenerRegistrationBean<IntrospectorCleanupListener> servletListenerRegistrationBean(IntrospectorCleanupListener myListener){
         ServletListenerRegistrationBean<IntrospectorCleanupListener> registrationBean = new ServletListenerRegistrationBean<IntrospectorCleanupListener>();
         
         registrationBean.setListener(myListener);
         return registrationBean;
        
    }
}

 

posted @ 2021-03-15 14:28  琴声清幽  阅读(401)  评论(0编辑  收藏  举报