Java Code Examples for org.springframework.boot.autoconfigure.condition.ConditionalOnBean

The following are top voted examples for showing how to use org.springframework.boot.autoconfigure.condition.ConditionalOnBean. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: xitikit-blue   File: B2CServicesAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean("blueKitB2CAuthenticationService")
@Autowired
@ConditionalOnMissingBean(B2CAuthenticationService.class)
@ConditionalOnBean(
  value = {B2CProperties.class, SignUpPolicy.class, SignInPolicy.class, SignUpOrSignInPolicy.class, ResetPasswordPolicy.class, EditProfilePolicy.class, SignOutPolicy.class, NonceProperties.class, NonceService.class})
public B2CAuthenticationService blueKitB2CAuthenticationService(
  final ClaimValidationService claimValidationService,
  final NonceService nonceService,
  final UrlService urlService,
  final RestTemplate restTemplate){

    return new SimpleB2CAuthenticationService(
      claimValidationService,
      nonceService,
      urlService,
      restTemplate);
}
 
Example 2
Project: zipkin-sparkstreaming   File: ZipkinStorageConsumerAutoConfiguration.java   View source code 6 votes vote down vote up
@ConditionalOnBean(StorageComponent.class)
@Bean StorageConsumer storageConsumer(
    StorageComponent component,
    @Value("${zipkin.sparkstreaming.consumer.storage.fail-fast:true}") boolean failFast,
    BeanFactory bf
) throws IOException {
  if (failFast) checkStorageOk(component);
  Properties properties = extractZipkinProperties(bf.getBean(ConfigurableEnvironment.class));
  if (component instanceof V2StorageComponent) {
    zipkin2.storage.StorageComponent v2Storage = ((V2StorageComponent) component).delegate();
    if (v2Storage instanceof ElasticsearchHttpStorage) {
      return new ElasticsearchStorageConsumer(properties);
    } else if (v2Storage instanceof zipkin2.storage.cassandra.CassandraStorage) {
      return new Cassandra3StorageConsumer(properties);
    } else {
      throw new UnsupportedOperationException(v2Storage + " not yet supported");
    }
  } else if (component instanceof CassandraStorage) {
    return new CassandraStorageConsumer(properties);
  } else if (component instanceof MySQLStorage) {
    return new MySQLStorageConsumer(properties);
  } else {
    throw new UnsupportedOperationException(component + " not yet supported");
  }
}
 
Example 3
Project: sample-boot-hibernate   File: ApplicationConfig.java   View source code 6 votes vote down vote up
/** 営業日チェック */
@Bean
@ConditionalOnBean(BusinessDayHandler.class)
HealthIndicator dayIndicator(final Timestamper time, final BusinessDayHandler day) {
    return new AbstractHealthIndicator() {
        @Override
        protected void doHealthCheck(Builder builder) throws Exception {
            builder.up();
            builder.withDetail("day", day.day())
                    .withDetail("dayMinus1", day.day(-1))
                    .withDetail("dayPlus1", day.day(1))
                    .withDetail("dayPlus2", day.day(2))
                    .withDetail("dayPlus3", day.day(3));
        }
    };
}
 
Example 4
Project: onetwo   File: BootSecurityCommonContextConfig.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean({LoggerInterceptor.class})
@ConditionalOnBean(BootSiteConfig.class)
@ConditionalOnProperty(value=AccessLogProperties.ENABLE_MVC_LOGGER_INTERCEPTOR, matchIfMissing=true, havingValue="true")
public LoggerInterceptor loggerInterceptor(){
	LoggerInterceptor log = new LoggerInterceptor();
	log.setUserDetailRetriever(()->{
		if(SecurityContextHolder.getContext().getAuthentication()==null)
			return null;
		Object user = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		if(UserDetail.class.isInstance(user)){
			return (UserDetail)user;
		}else if(User.class.isInstance(user)){
			User suser = (User)user;
			SimpleUserDetail ud = new SimpleUserDetail();
			ud.setUserName(suser.getUsername());
			return ud;
		}
		return null;
	});
	log.setPathPatterns(accessLogProperties.getPathPatterns());
	return log;
}
 
Example 5
Project: onetwo   File: WebAdminPluginContext.java   View source code 6 votes vote down vote up
@Bean
	@Autowired
	@ConditionalOnBean(RootMenuClassProvider.class)
	public AdminPermissionConfigListAdapetor adminPermissionConfigListAdapetor(List<RootMenuClassProvider> providers){
		AdminPermissionConfigListAdapetor list = new AdminPermissionConfigListAdapetor();
		providers.forEach(provider->{
			Collection<Class<?>> rooMenuClassList = new HashSet<>();
			if(provider instanceof RootMenuClassListProvider){
				rooMenuClassList.addAll(((RootMenuClassListProvider)provider).rootMenuClassList());
			}else{
				rooMenuClassList.add(provider.rootMenuClass());
			}
			rooMenuClassList.forEach(rootMenuClass->{
				WebAdminPermissionConfig config = new WebAdminPermissionConfig();
//				config.setRootMenuClassProvider(provider);
				config.setRootMenuClass(rootMenuClass);
				list.add(config);
			});
		});
		return list;
	}
 
Example 6
Project: uimaster   File: PersistentConfig.java   View source code 6 votes vote down vote up
@Bean
	@ConditionalOnBean(name = "dataSource")
	public EntityManagerFactory entityManagerFactory() {
		HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
		vendorAdapter.setGenerateDdl(true);

		LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
		factory.setJpaVendorAdapter(vendorAdapter);
		factory.setPackagesToScan("org.shaolin");
		factory.setDataSource(dataSource());
//		factory.setPersistenceUnitManager(persistenceUnitManager);
//		factory.setMappingResources(mappingResources);
		factory.afterPropertiesSet();

		return factory.getObject();
	}
 
Example 7
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(ConnectionFactoryLocator.class)
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public SpringSocialTokenServices socialTokenServices() {
	return new SpringSocialTokenServices(this.connectionFactory,
			this.sso.getClientId());
}
 
Example 8
Project: cas-5.1.0   File: CasReportsConfiguration.java   View source code 5 votes vote down vote up
@Profile("standalone")
@ConditionalOnBean(name = "configurationPropertiesEnvironmentManager")
@Bean
@RefreshScope
public MvcEndpoint internalConfigController() {
    return new ConfigurationStateController(casProperties);
}
 
Example 9
Project: cereebro   File: CereebroEurekaInstanceAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(SnitchEndpoint.class)
public EurekaMetadataPopulator eurekaMetadataPopulator(SnitchEndpoint snitch, ApplicationInfoManager manager,
        ObjectMapper mapper) {
    RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(env, "cereebro.snitch.eureka.");
    EurekaInstanceSnitchProperties props = new EurekaInstanceSnitchProperties();
    props.setEndpointUrl(relaxedPropertyResolver.getProperty("endpointUrl"));
    props.setEndpointUrlPath(relaxedPropertyResolver.getProperty("endpointUrlPath"));
    EurekaMetadataPopulator metadataPopulator = new EurekaMetadataPopulator(snitch, manager, props, mapper);
    metadataPopulator.populate();
    return metadataPopulator;
}
 
Example 10
Project: elephant   File: ActivemqConfig.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(JmsTemplate.class)
public ProducerService activemqProducerService(JmsTemplate jmsTemplate){
	ActivemqProducerService activemqProducer = new ActivemqProducerService();
	activemqProducer.setJmsTemplate(jmsTemplate);
	return activemqProducer;
}
 
Example 11
Project: spring-boot-autoconfigure   File: MyBatisAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnBean(SqlSession.class)
@ConditionalOnMissingBean
public SqlMapper sqlMapper(SqlSession sqlSession) {
    return new SqlMapper(sqlSession);
}
 
Example 12
Project: spring-data-snowdrop   File: SnowdropDataInfinispanEmbeddedAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EntityToCacheMapper.class)
@ConditionalOnBean(EmbeddedCacheManager.class)
public EntityToCacheMapper createDefaultEntityToCacheMapper(final EmbeddedCacheManager cacheManager) {
    return new EntityToCacheMapper() {
        public <ID, T> Cache<ID, T> getCache(Class<T> entityClass) {
            return cacheManager.getCache(); // always return default cache
        }
    };
}
 
Example 13
Project: spring-data-snowdrop   File: SnowdropDataInfinispanRemoteAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EntityToRemoteCacheMapper.class)
@ConditionalOnBean(RemoteCacheManager.class)
public EntityToRemoteCacheMapper createDefaultEntityToCacheMapper(final RemoteCacheManager cacheManager) {
    return new EntityToRemoteCacheMapper() {
        public <ID, T> RemoteCache<ID, T> getRemoteCache(Class<T> entityClass) {
            return cacheManager.getCache(); // always return default cache
        }
    };
}
 
Example 14
Project: quickfixj-spring-boot-starter   File: QuickFixJServerEndpointAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(name = {"serverAcceptor", "serverSessionSettings"})
@ConditionalOnClass({Acceptor.class, SessionSettings.class})
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint("quickfixjserver")
public QuickFixJServerEndpoint quickfixjServerEndpoint(Acceptor serverAcceptor, SessionSettings serverSessionSettings) {
    return new QuickFixJServerEndpoint(serverAcceptor, serverSessionSettings);
}
 
Example 15
Project: quickfixj-spring-boot-starter   File: QuickFixJClientEndpointAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
   @ConditionalOnBean(name = {"clientInitiator", "clientSessionSettings"})
   @ConditionalOnClass({Initiator.class, SessionSettings.class})
   @ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint("quickfixjclient")
   public QuickFixJClientEndpoint quickfixjClientEndpoint(Initiator clientInitiator, SessionSettings clientSessionSettings) {
       return new QuickFixJClientEndpoint(clientInitiator, clientSessionSettings);
   }
 
Example 16
Project: spring-cloud-dashboard   File: DataFlowControllerAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(ApplicationDefinitionRepository.class)
public ApplicationDefinitionController applicationDefinitionController(ApplicationDefinitionRepository repository,
		DeploymentIdRepository deploymentIdRepository, ApplicationDeploymentController deploymentController,
		AppDeployer deployer, AppRegistry appRegistry) {
	return new ApplicationDefinitionController(repository, deploymentIdRepository, deploymentController, deployer, appRegistry);
}
 
Example 17
Project: spring-cloud-dashboard   File: DataFlowControllerAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(ApplicationDefinitionRepository.class)
public ApplicationDeploymentController applicationDeploymentController(ApplicationDefinitionRepository repository,
		DeploymentIdRepository deploymentIdRepository, EavRegistryRepository eavRegistryRepository,
		AppDeployer deployer, AppRegistry appRegistry, ApplicationConfigurationMetadataResolver metadataResolver,
		CommonApplicationProperties appsProperties) {
	return new ApplicationDeploymentController(repository, deploymentIdRepository, eavRegistryRepository, deployer,
			appRegistry, metadataResolver, appsProperties);
}
 
Example 18
Project: java-spring-cloud   File: WebsocketAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(WebSocketMessageBrokerConfigurationSupport.class)
public TracingChannelInterceptor tracingInboundChannelInterceptor(
    WebSocketMessageBrokerConfigurationSupport config) {
  TracingChannelInterceptor interceptor = new TracingChannelInterceptor(tracer,
      Tags.SPAN_KIND_SERVER);
  config.clientInboundChannel().addInterceptor(interceptor);
  return interceptor;
}
 
Example 19
Project: java-spring-cloud   File: WebsocketAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(WebSocketMessageBrokerConfigurationSupport.class)
public TracingChannelInterceptor tracingOutboundChannelInterceptor(
    WebSocketMessageBrokerConfigurationSupport config) {
  TracingChannelInterceptor interceptor = new TracingChannelInterceptor(tracer,
      Tags.SPAN_KIND_CLIENT);
  config.clientOutboundChannel().addInterceptor(interceptor);
  return interceptor;
}
 
Example 20
Project: nakadi-producer-spring-boot-starter   File: NakadiProducerAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(SnapshotEventCreationEndpoint.class)
@ConditionalOnEnabledEndpoint("snapshot_event_creation")
public SnapshotEventCreationMvcEndpoint snapshotEventCreationMvcEndpoint(
        SnapshotEventCreationEndpoint snapshotEventCreationEndpoint) {
    return new SnapshotEventCreationMvcEndpoint(snapshotEventCreationEndpoint);
}
 
Example 21
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitB2CPolicy")
@ConditionalOnBean(B2CProperties.class)
@ConfigurationProperties("blue-kit.b2c")
public B2CProperties blueKitB2CProperties(){

    return new B2CProperties();
}
 
Example 22
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitSignUpPolicy")
@ConditionalOnBean(SignUpPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-up", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.sign-up")
public SignUpPolicy blueKitSignUpPolicy(){

    return new SignUpPolicy();
}
 
Example 23
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitSignInPolicy")
@ConditionalOnBean(SignInPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-in", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.sign-in")
public SignInPolicy blueKitSignInPolicy(){

    return new SignInPolicy();
}
 
Example 24
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitSignUpOrSignInPolicy")
@ConditionalOnBean(SignUpOrSignInPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-up-or-sign-in", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.sign-up-or-sign-in")
public SignUpOrSignInPolicy blueKitSignUpOrSignInPolicy(){

    return new SignUpOrSignInPolicy();
}
 
Example 25
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitEditProfilePolicy")
@ConditionalOnBean(EditProfilePolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.edit-profile", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.edit-profile")
public EditProfilePolicy blueKitEditProfilePolicy(){

    return new EditProfilePolicy();
}
 
Example 26
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitResetPasswordPolicy")
@ConditionalOnBean(ResetPasswordPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.edit-profile", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.reset-password")
public ResetPasswordPolicy blueKitResetPasswordPolicy(){

    return new ResetPasswordPolicy();
}
 
Example 27
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitSignOutPolicy")
@ConditionalOnBean(SignOutPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-out")
@ConfigurationProperties("blue-kit.b2c.policy.sign-out")
public SignOutPolicy blueKitSignOutPolicy(){

    return new SignOutPolicy();
}
 
Example 28
Project: xitikit-blue   File: B2CPolicyAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean("blueKitChangeEmailPolicy")
@ConditionalOnBean(ChangeEmailPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.change-email", value = {"name", "redirect-url", "template-url"})
@ConfigurationProperties("blue-kit.b2c.policy.change-email")
public ChangeEmailPolicy blueKitChangeEmailPolicy(){

    throw new NotFoundException("'change-email' is not a valid policy (yet) provided by Microsoft's Azure AD B2C. You must manually change the email using the GraphApi instead.");
}
 
Example 29
Project: xitikit-blue   File: B2CServicesAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@Autowired
@ConditionalOnBean(NonceProperties.class)
@ConditionalOnMissingBean(NonceService.class)
public NonceService blueKitNonceService(final NonceStore nonceStore, final NonceProperties nonceProperties){
    //TODO: Add logic for checking whether a shared caching framework is enabled
    if(nonceProperties.isDisabled()){
        return new NonceService(){

            @Override
            @NonNull
            public Nonce generate(){

                return new Nonce();
            }

            @Override
            public boolean isValid(final String nonce){

                return false;
            }

            @Override
            public boolean isDisabled(){

                return true;
            }
        };
    }
    return new SimpleNonceService(nonceStore, nonceProperties);
}
 
Example 30
Project: hsweb-framework   File: DefaultAuthorizationAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(AuthenticationManager.class)
public UserTokenAuthenticationSupplier userTokenAuthenticationSupplier(AuthenticationManager authenticationManager) {
    UserTokenAuthenticationSupplier supplier= new UserTokenAuthenticationSupplier(authenticationManager);
    AuthenticationHolder.addSupplier(supplier);
    return supplier;
}
 
Example 31
Project: elastic-crud   File: ElasticSearchRepositoryFactoryAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(DatabaseRepositoryFactory.class)
@ConditionalOnBean(value={Client.class, JsonSerializationFactory.class, DatabaseScrollingFactory.class})
DatabaseRepositoryFactory databaseRepositoryFactory(
  final Client client,
  final JsonSerializationFactory serialization,
  final DatabaseScrollingFactory factory) {
  return new ElasticSearchRepositoryFactory(serialization, client, factory);
}
 
Example 32
Project: elastic-crud   File: JacksonConversionAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@Autowired
@ConditionalOnBean(ObjectMapper.class)
@ConditionalOnMissingBean(JsonSerializationFactory.class)
JsonSerializationFactory jsonSerializationFactory(final ObjectMapper mapper) {
  return new JacksonSerializationFactory(mapper);
}
 
Example 33
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: MockMvcWebClientAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean({ WebClient.class, MockMvcWebClientBuilder.class })
@ConditionalOnBean(MockMvc.class)
public MockMvcWebClientBuilder mockMvcWebClientBuilder(MockMvc mockMvc) {
	return MockMvcWebClientBuilder.mockMvcSetup(mockMvc)
			.withDelegate(new LocalHostWebClient(this.environment));
}
 
Example 34
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: MockMvcWebDriverAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean({ WebDriver.class, MockMvcHtmlUnitDriverBuilder.class })
@ConditionalOnBean(MockMvc.class)
public MockMvcHtmlUnitDriverBuilder mockMvcHtmlUnitDriverBuilder(MockMvc mockMvc) {
	return MockMvcHtmlUnitDriverBuilder.mockMvcSetup(mockMvc)
			.withDelegate(new LocalHostWebConnectionHtmlUnitDriver(this.environment,
					BrowserVersion.CHROME));
}
 
Example 35
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: EndpointWebMvcHypermediaManagementContextConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(DocsMvcEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
		ManagementServerProperties management, DocsMvcEndpoint endpoint) {
	String path = management.getContextPath() + endpoint.getPath()
			+ "/#spring_boot_actuator__{rel}";
	if (server.getPort().equals(management.getPort()) && management.getPort() != 0) {
		path = server.getPath(path);
	}
	return new DefaultCurieProvider("boot", new UriTemplate(path));
}
 
Example 36
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: DispatcherServletAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(MultipartResolver.class)
@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
public MultipartResolver multipartResolver(MultipartResolver resolver) {
	// Detect if the user has created a MultipartResolver but named it incorrectly
	return resolver;
}
 
Example 37
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: DispatcherServletAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean(name = DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)
@ConditionalOnBean(value = DispatcherServlet.class, name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)
public ServletRegistrationBean dispatcherServletRegistration(
		DispatcherServlet dispatcherServlet) {
	ServletRegistrationBean registration = new ServletRegistrationBean(
			dispatcherServlet, this.serverProperties.getServletMapping());
	registration.setName(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME);
	registration.setLoadOnStartup(
			this.webMvcProperties.getServlet().getLoadOnStartup());
	if (this.multipartConfig != null) {
		registration.setMultipartConfig(this.multipartConfig);
	}
	return registration;
}
 
Example 38
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: ErrorMvcAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(DispatcherServlet.class)
@ConditionalOnMissingBean
public DefaultErrorViewResolver conventionErrorViewResolver() {
	return new DefaultErrorViewResolver(this.applicationContext,
			this.resourceProperties);
}
 
Example 39
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: WebMvcAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(View.class)
@ConditionalOnMissingBean
public BeanNameViewResolver beanNameViewResolver() {
	BeanNameViewResolver resolver = new BeanNameViewResolver();
	resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 10);
	return resolver;
}
 
Example 40
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: WebMvcAutoConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnBean(ViewResolver.class)
@ConditionalOnMissingBean(name = "viewResolver", value = ContentNegotiatingViewResolver.class)
public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) {
	ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
	resolver.setContentNegotiationManager(
			beanFactory.getBean(ContentNegotiationManager.class));
	// ContentNegotiatingViewResolver uses all the other view resolvers to locate
	// a view so it should have a high precedence
	resolver.setOrder(Ordered.HIGHEST_PRECEDENCE);
	return resolver;
}