SpringMvc怎么把web.xml配置换成java配置

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
<!--             classpath:db.properties -->
<!--             classpath:main-config.xml -->
<!--             classpath:config/fweb-archetype-mvc.xml -->
            classpath:config/fweb-shiro-mvc.xml
        </param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <filter>
        <filter-name>shiroFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        <!-- 设置true由servlet容器控制filter的生命周期 -->
        <init-param>
            <param-name>targetFilterLifecycle</param-name>
            <param-value>true</param-value>
        </init-param>
        <!-- 设置spring容器filter的bean id,如果不设置则找与filter-name一致的bean-->
        <init-param>
            <param-name>targetBeanName</param-name> 
            <param-value>shiroFilter</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>shiroFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

把上面的配置全部通过java方式配置要如何写

前人好不容易转化为配置文件的形式,为啥要化简为繁,如果嫌配置文件太多可以去尝试springboot

https://blog.csdn.net/qq_21602341/article/details/78843588

https://www.cnblogs.com/lwx521/p/7944109.html