- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个 Springboot 应用程序,其中服务器启动 (Tomcat) 会初始化一堆类。有一些不需要的正在初始化,我正在尝试提高启动性能,所以不想初始化这些类。我尝试在带有 excludeName 参数的 SpringBootServletInitializer 中使用 @EnableAutoConfiguration 注释,如下所示:
@EnableAutoConfiguration(excludeName = "com.foler.subfolder.ExampleClass")
我还尝试了另一个参数 @EnableAutoConfiguration(exclude = ExampelClass.class)
最佳答案
There are some unwanted ones being initialized and I am trying to improve the performance of startup so don't want to initialize these classes.
自动配置(使用 @EnableAutoConfiguration
)总是在用户定义的 bean 注册后应用,看 here在同一点上来自此处的 API。
所以,你实际上应该使用 @ComponentScan
过滤类作为扫描的一部分,这样容器可能会加速(因为它不会在容器启动期间从排除的包/类创建 bean 对象)。
@ComponentScan(basePackages = {"com.foler"},
excludeFilters = @ComponentScan.Filter(
type=FilterType.ASSIGNABLE_TYPE,
value = ExampelClass.class))
Is there any way I can add two or more classes for value parameter?
values
接受类型 Class[]
array ,因此您可以将多个类设置为 value = {ExampelClass1.class, ExampelClass2.class}
关于tomcat - @EnableAutoConfiguration - excludeName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43312892/
我正在开发一个 Springboot 应用程序,其中服务器启动 (Tomcat) 会初始化一堆类。有一些不需要的正在初始化,我正在尝试提高启动性能,所以不想初始化这些类。我尝试在带有 excludeN
我是一名优秀的程序员,十分优秀!