How to imitate WebMvcConfigurerAdapter to add configuration flexibly

  1. problem description

I am writing a framework, but the main function is that the lower computer communicates with the host computer in a protocol similar to json, both sides can flexibly find fields through several index tables (for example, this string of binary data describes a business model, and I need to parse this string of binary data into a Java object). For the flexibility of the framework, I want to imitate WebMvcConfigurerAdapter in Spring, but now I have encountered a problem. The things I wrote are very complicated, so I won"t post them. I would like to ask for help from all kinds of gods.

you can reference the spring framework

this configuration is similar to the following

@Configuration
public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
    /**
     * 
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/my/**").addResourceLocations("classpath:/my/");
        super.addResourceHandlers(registry);
    }
}
  1. final destination
@Configuration
public class ProtocolIndexConfigurerAdapterImpl extends ProtocolIndexConfigurerAdapter {
    /**
     * 
     * @param registry
     */
    @Override
    public void addIndex(ProtocolIndexRegistry registry) {
       // 0001
       register.addTypeIndex("0001").register("id");
       register.addTypeIndex("0002").register("name");
    }
}
Mar.16,2021

Update 2:

it suddenly occurred to me that your configuration, which is more similar to interceptors and filters, can be referred to.

< hr >

Update:

@Bean(name = "example")
public SomeAdapter extends ProtocolIndexConfigurerAdapter {
    @Override
    public void addIndex(ProtocolIndexRegistry registry) {
        // do something here.
    }
}
This is the impression of

, you can give it a try, mainly the use of @ ConditionOnxxx annotations, and give an empty default implementation to avoid throwing an exception if you can't find the implementation class.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3892b-2c12c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3892b-2c12c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?