This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample.tomcat; | |
import java.io.IOException; | |
import java.util.concurrent.TimeUnit; | |
import org.apache.commons.logging.LogFactory; | |
import org.springframework.core.io.ClassPathResource; | |
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; | |
public class TimeMe { | |
private static final ClassPathResource[] RESOURCES = { | |
new ClassPathResource("org/springframework/stereotype/Component.class"), | |
new ClassPathResource("org/springframework/stereotype/Indexed.class"), | |
new ClassPathResource("org/springframework/stereotype/Controller.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/context/annotation/Configuration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/AutoConfigureOrder.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/websocket/reactive/WebSocketReactiveAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerFactoryAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/websocket/servlet/WebSocketServletAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/websocket/servlet/WebSocketServletAutoConfiguration$UndertowWebSocketConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/websocket/servlet/WebSocketServletAutoConfiguration$JettyWebSocketConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/websocket/servlet/WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/condition/ConditionalOnClass.class"), | |
new ClassPathResource( | |
"org/springframework/context/annotation/Conditional.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplication.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/AutoConfigureBefore.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration$BeanPostProcessorsRegistrar.class"), | |
new ClassPathResource( | |
"org/springframework/boot/context/properties/EnableConfigurationProperties.class"), | |
new ClassPathResource("org/springframework/context/annotation/Import.class"), | |
new ClassPathResource( | |
"org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedJetty.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedUndertow.class"), | |
new ClassPathResource( | |
"org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector$ConfigurationPropertiesBeanRegistrar.class"), | |
new ClassPathResource( | |
"org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.class"), | |
new ClassPathResource( | |
"org/springframework/context/annotation/ImportBeanDefinitionRegistrar.class"), | |
new ClassPathResource( | |
"org/springframework/beans/factory/BeanFactoryAware.class"), | |
new ClassPathResource("org/springframework/beans/factory/Aware.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletRegistrationCondition.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DefaultDispatcherServletCondition.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/AutoConfigureAfter.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$PreserveErrorControllerTargetClassPostProcessor.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$ErrorPageCustomizer.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$ExpressionResolver.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$ExpressionCollector.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$SpelView.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$ErrorTemplateMissingCondition.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$OptionalPathExtensionContentNegotiationStrategy.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$ResourceChainResourceHandlerRegistrationCustomizer.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$ResourceHandlerRegistrationCustomizer.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$ResourceChainCustomizerConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/context/ResourceLoaderAware.class"), | |
new ClassPathResource("org/springframework/core/annotation/Order.class"), | |
new ClassPathResource( | |
"org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.class"), | |
new ClassPathResource( | |
"org/springframework/context/ApplicationContextAware.class"), | |
new ClassPathResource( | |
"org/springframework/web/context/ServletContextAware.class"), | |
new ClassPathResource( | |
"org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport$NoOpValidator.class"), | |
new ClassPathResource( | |
"org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport$EmptyHandlerMapping.class"), | |
new ClassPathResource( | |
"org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.class"), | |
new ClassPathResource("org/springframework/context/EnvironmentAware.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration$CacheConfigurationImportSelector.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration$CacheManagerValidator.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration$CacheManagerJpaDependencyConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/condition/ConditionalOnBean.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/GenericCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/RedisCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/CaffeineCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/SimpleCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/cache/NoOpCacheConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/beans/factory/BeanClassLoaderAware.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/JacksonHttpMessageConvertersConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/GsonHttpMessageConvertersConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/JsonbHttpMessageConvertersConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/JacksonHttpMessageConvertersConfiguration$MappingJackson2XmlHttpMessageConverterConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/codec/CodecsAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/http/codec/CodecsAutoConfiguration$JacksonCodecConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration$GitResourceAvailableCondition.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/mail/MailSenderValidatorAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/security/reactive/ReactiveSecurityAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/security/reactive/WebFluxSecurityConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration$UndertowWebServerFactoryCustomizerConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration$JettyWebServerFactoryCustomizerConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfiguration.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfiguration$LocaleCharsetMappingsCustomizer.class"), | |
new ClassPathResource( | |
"org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfiguration.class") }; | |
public static void main(String[] args) throws IOException { | |
LogFactory.getLog(TimeMe.class); | |
System.err.println(RESOURCES.length); | |
SimpleMetadataReaderFactory factory = new SimpleMetadataReaderFactory(); | |
long t = System.nanoTime(); | |
for (ClassPathResource resource : RESOURCES) { | |
factory.getMetadataReader(resource).getAnnotationMetadata(); | |
} | |
System.err.println(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment