Spring konfiguracja

Odpowiedz Nowy wątek
2020-05-24 19:08

Rejestracja: 4 miesiące temu

Ostatnio: 3 miesiące temu

0

Hej,

Mam klasę konfiguracyjną jak poniżej. Rozumiem, że ViewControllerRegistry przechowywany jest w kontekście aplikacji springa jako bean. Chciałem to sprawdzić więc napisałem kod, który wyświetla wszystkie beany przechowywane w kontekście aplikacji. Dlaczego w poniższej liście nie znajduję ViewControllerRegistry?

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

        registry.addViewController("/").setViewName("home");
    }
}

amqpAdmin
applicationTaskExecutor
basicErrorController
beanNameHandlerMapping
beanNameViewResolver
characterEncodingFilter
classPathFileSystemWatcher
classPathRestartStrategy
commandLineRunner
comunicate
conditionEvaluationDeltaLoggingListener
conventionErrorViewResolver
cruddbApplication
dataSource
dataSourceInitializedPublisher
dataSourceInitializerPostProcessor
defaultServletHandlerMapping
defaultTemplateResolver
defaultValidator
defaultViewResolver
directRabbitListenerContainerFactoryConfigurer
dispatcherServlet
dispatcherServletRegistration
emBeanDefinitionRegistrarPostProcessor
entityManagerFactory
entityManagerFactoryBuilder
error
errorAttributes
errorPageCustomizer
errorPageRegistrarBeanPostProcessor
fileSystemWatcherFactory
flightController
flightService
formContentFilter
groupByNameConveter
groupRepository
groupRepositoryService
groupRestController
h2Console
handlerExceptionResolver
handlerFunctionAdapter
hikariPoolDataSourceMetadataProvider
httpRequestHandlerAdapter
inMemoryDatabaseShutdownExecutor
jacksonGeoModule
jacksonObjectMapper
jacksonObjectMapperBuilder
java8TimeDialect
jdbcTemplate
jpaContext
jpaMappingContext
jpaVendorAdapter
jsonComponentModule
liveReloadServer
liveReloadServerEventListener
localeCharsetMappingsCustomizer
mappingJackson2HttpMessageConverter
messageConverters
methodValidationPostProcessor
multipartConfigElement
multipartResolver
mvcContentNegotiationManager
mvcConversionService
mvcHandlerMappingIntrospector
mvcPathMatcher
mvcResourceUrlProvider
mvcUriComponentsContributor
mvcUrlPathHelper
mvcValidator
mvcViewResolver
namedParameterJdbcTemplate
openEntityManagerInViewInterceptor
openEntityManagerInViewInterceptorConfigurer
optionalLiveReloadServer
org.springframework.amqp.rabbit.config.internalRabbitListenerAnnotationProcessor
org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry
org.springframework.aop.config.internalAutoProxyCreator
org.springframework.boot.autoconfigure.AutoConfigurationPackages
org.springframework.boot.autoconfigure.amqp.RabbitAnnotationDrivenConfiguration
org.springframework.boot.autoconfigure.amqp.RabbitAnnotationDrivenConfiguration$EnableRabbitConfiguration
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration$MessagingTemplateConfiguration
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration$RabbitConnectionFactoryCreator
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration$RabbitTemplateConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$AspectJAutoProxyingConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$AspectJAutoProxyingConfiguration$CglibAutoProxyConfiguration
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration
org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration
org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration
org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari
org.springframework.boot.autoconfigure.jdbc.DataSourceInitializationConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
org.springframework.boot.autoconfigure.jdbc.DataSourceJmxConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceJmxConfiguration$Hikari
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration
org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration
org.springframework.boot.autoconfigure.jdbc.JdbcTemplateConfiguration
org.springframework.boot.autoconfigure.jdbc.NamedParameterJdbcTemplateConfiguration
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration
org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration
org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafJava8TimeDialect
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafWebMvcConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafWebMvcConfiguration$ThymeleafViewResolverConfiguration
org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration
org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration$CglibAutoProxyConfiguration
org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$TransactionTemplateConfiguration
org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration
org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration
org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration
org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration
org.springframework.boot.context.internalConfigurationPropertiesBinder
org.springframework.boot.context.internalConfigurationPropertiesBinderFactory
org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator
org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor
org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration
org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration$DatabaseShutdownExecutorEntityManagerFactoryDependsOnPostProcessor
org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration
org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$LiveReloadConfiguration
org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$RestartConfiguration
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalPersistenceAnnotationProcessor
org.springframework.context.event.internalEventListenerFactory
org.springframework.context.event.internalEventListenerProcessor
org.springframework.data.jpa.repository.support.JpaEvaluationContextExtension
org.springframework.data.jpa.util.JpaMetamodelCacheCleanup
org.springframework.data.web.config.ProjectingArgumentResolverRegistrar
org.springframework.data.web.config.SpringDataJacksonConfiguration
org.springframework.data.web.config.SpringDataWebConfiguration
org.springframework.orm.jpa.SharedEntityManagerCreator#0
org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration
org.springframework.transaction.config.internalTransactionAdvisor
org.springframework.transaction.config.internalTransactionalEventListenerFactory
pageableCustomizer
pageableResolver
parameterNamesModule
persistenceExceptionTranslationPostProcessor
platformTransactionManagerCustomizers
preserveErrorControllerTargetClassPostProcessor
projectingArgumentResolverBeanPostProcessor
propertySourcesPlaceholderConfigurer
rabbitConnectionFactory
rabbitListenerContainerFactory
rabbitMessagingTemplate
rabbitTemplate
requestContextFilter
requestMappingHandlerAdapter
requestMappingHandlerMapping
resourceHandlerMapping
restTemplateBuilder
restTepmlate
restartingClassPathChangedEventListener
routerFunctionMapping
server-org.springframework.boot.autoconfigure.web.ServerProperties
servletWebServerFactoryCustomizer
simpleControllerHandlerAdapter
simpleRabbitListenerContainerFactoryConfigurer
sortCustomizer
sortResolver
spring.data.web-org.springframework.boot.autoconfigure.data.web.SpringDataWebProperties
spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties
spring.h2.console-org.springframework.boot.autoconfigure.h2.H2ConsoleProperties
spring.http-org.springframework.boot.autoconfigure.http.HttpProperties
spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties
spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties
spring.jdbc-org.springframework.boot.autoconfigure.jdbc.JdbcProperties
spring.jpa-org.springframework.boot.autoconfigure.orm.jpa.JpaProperties
spring.jpa.hibernate-org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties
spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties
spring.rabbitmq-org.springframework.boot.autoconfigure.amqp.RabbitProperties
spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties
spring.security.oauth2.resourceserver-org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties
spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties
spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties
spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties
spring.thymeleaf-org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties
spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties
standardJacksonObjectMapperBuilderCustomizer
stringHttpMessageConverter
studentController
studentRepository
studentRepositoryService
studentRestController
taskExecutorBuilder
taskSchedulerBuilder
templateEngine
thymeleafViewResolver
tomcatServletWebServerFactory
tomcatServletWebServerFactoryCustomizer
tomcatWebServerFactoryCustomizer
transactionAttributeSource
transactionInterceptor
transactionManager
transactionTemplate
viewControllerHandlerMapping
viewResolver
webConfig
webServerFactoryCustomizerBeanPostProcessor
websocketServletWebServerCustomizer
welcomePageHandlerMapping

Cóż to za straszna wklejka? - AnyKtokolwiek 2020-05-24 19:33

Pozostało 580 znaków

2020-05-24 20:05

Rejestracja: 4 lata temu

Ostatnio: 3 godziny temu

Rozumiem, że ViewControllerRegistry przechowywany jest w kontekście aplikacji springa jako bean.

Nie ma powodu, żeby tak myśleć. To najprawdopodobniej jest jakaś pomocnicza klasa na podstawie której później jest tworzony bean z mapowaniami. Jeśli dobrze pamiętam tym beanem, który Cię interesuje jest RequestMappingHandlerMapping. Jak bardzo potrzebujesz tej wiedzy to zawsze możesz sobie ściągnąć mavenem kod springa i sobie CTRL + left click przeklikać gdzie ta metoda addViewControllers(ViewControllerRegistry registry) jest wykorzystywana.


#define true (rand() % 2)
edytowany 2x, ostatnio: Grzyboo, 2020-05-24 20:06

Pozostało 580 znaków

Odpowiedz

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0