Here are the examples of the java api org.springframework.util.ClassUtils.isPresent() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
106 Examples
19
View Source File : FieldUtil.java
License : MIT License
Project Creator : yuequan1997
License : MIT License
Project Creator : yuequan1997
public static JsonMapper createJsonMapper() {
if (ClreplacedUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", null)) {
return new JacksonMapper();
} else if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new Jackson2Mapper();
}
return new NotSupportedJsonMapper();
}
19
View Source File : Assume.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
public static void javaEight() {
if (ClreplacedUtils.isPresent("java.security.cert.URICertStoreParameters", null)) {
throw new replacedumptionViolatedException("replacedumed Java 8 but got Java 9");
}
}
19
View Source File : RestDocsTestExecutionListener.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean restDocsIsPresent() {
return ClreplacedUtils.isPresent(REST_DOCS_CLreplaced, getClreplaced().getClreplacedLoader());
}
19
View Source File : SpyBeanWithAopProxyTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isTestingMockito1() {
return ClreplacedUtils.isPresent("org.mockito.ReturnValues", null);
}
19
View Source File : WebTestClientContextCustomizerFactory.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isWebClientPresent() {
return ClreplacedUtils.isPresent(WEB_TEST_CLIENT_CLreplaced, getClreplaced().getClreplacedLoader());
}
19
View Source File : ClassLoaderFilesResourcePatternResolver.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private ResourcePatternResolverFactory getResourcePatternResolverFactory() {
if (ClreplacedUtils.isPresent(WEB_CONTEXT_CLreplaced, null)) {
return new WebResourcePatternResolverFactory();
}
return new ResourcePatternResolverFactory();
}
19
View Source File : AgentReloader.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private static boolean isActive(ClreplacedLoader clreplacedLoader) {
for (String agentClreplaced : AGENT_CLreplacedES) {
if (ClreplacedUtils.isPresent(agentClreplaced, clreplacedLoader)) {
return true;
}
}
return false;
}
19
View Source File : HibernateJpaConfiguration.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean runningOnWebSphere() {
return ClreplacedUtils.isPresent("com.ibm.websphere.jtaextensions.ExtendedJTATransaction", getClreplaced().getClreplacedLoader());
}
19
View Source File : ArtemisConnectionFactoryFactory.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private void startEmbeddedJms() {
if (ClreplacedUtils.isPresent(EMBEDDED_JMS_CLreplaced, null)) {
try {
this.beanFactory.getBeansOfType(Clreplaced.forName(EMBEDDED_JMS_CLreplaced));
} catch (Exception ex) {
// Ignore
}
}
}
19
View Source File : AuthenticationAuditListener.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private static WebAuditListener maybeCreateWebListener() {
if (ClreplacedUtils.isPresent(WEB_LISTENER_CHECK_CLreplaced, null)) {
return new WebAuditListener();
}
return null;
}
19
View Source File : SslServerCustomizer.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isConscryptPresent() {
return ClreplacedUtils.isPresent("org.conscrypt.Conscrypt", null);
}
19
View Source File : SslServerCustomizer.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isAlpnPresent() {
return ClreplacedUtils.isPresent("org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory", null);
}
19
View Source File : Slf4JLoggingSystem.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
protected final boolean isBridgeHandlerAvailable() {
return ClreplacedUtils.isPresent(BRIDGE_HANDLER, getClreplacedLoader());
}
19
View Source File : Log4J2LoggingSystem.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
protected boolean isClreplacedAvailable(String clreplacedName) {
return ClreplacedUtils.isPresent(clreplacedName, getClreplacedLoader());
}
19
View Source File : JsonParserFactory.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
/**
* Static factory for the "best" JSON parser available on the clreplacedpath. Tries
* Jackson, then Gson, Snake YAML, and then falls back to the {@link BasicJsonParser}.
* @return a {@link JsonParser}
*/
public static JsonParser getJsonParser() {
if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new JacksonJsonParser();
}
if (ClreplacedUtils.isPresent("com.google.gson.Gson", null)) {
return new GsonJsonParser();
}
if (ClreplacedUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) {
return new YamlJsonParser();
}
return new BasicJsonParser();
}
19
View Source File : BeanDefinitionLoader.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isGroovyPresent() {
return ClreplacedUtils.isPresent("groovy.lang.MetaClreplaced", null);
}
19
View Source File : TypeServiceGenerator.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
public void process(Clreplaced<?> application, Set<JavaFile> files) {
if (ClreplacedUtils.isPresent(application.getName().replace("$", "_") + "Initializer", null)) {
files.add(process(application));
}
}
19
View Source File : CompositeTextMapPropagator.java
License : Apache License 2.0
Project Creator : spring-cloud-incubator
License : Apache License 2.0
Project Creator : spring-cloud-incubator
private boolean isOnClreplacedpath(String clazz) {
return ClreplacedUtils.isPresent(clazz, null);
}
19
View Source File : SofaTracerConfigurationListener.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
private boolean isSpringCloud() {
return ClreplacedUtils.isPresent("org.springframework.cloud.bootstrap.BootstrapConfiguration", null);
}
19
View Source File : SofaBootEnvUtils.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
/**
* Check whether import spring cloud BootstrapConfiguration
* @return
*/
public static boolean isSpringCloud() {
return ClreplacedUtils.isPresent(SPRING_CLOUD_MARK_NAME, null);
}
19
View Source File : WebEmbeddedContainerMatcher.java
License : GNU General Public License v3.0
Project Creator : shixinyangyy
License : GNU General Public License v3.0
Project Creator : shixinyangyy
public static void embeddedContainerMatcher() {
if (ClreplacedUtils.isPresent(STARTUP_TOMCAT, null)) {
throw new UnsupportedOperationException("The project does not support the Tomcat.");
}
}
19
View Source File : EntityManagerFactoryServiceImpl.java
License : Apache License 2.0
Project Creator : muxiangqiu
License : Apache License 2.0
Project Creator : muxiangqiu
private boolean runningOnWebSphere() {
return ClreplacedUtils.isPresent("com.ibm.websphere.jtaextensions." + "ExtendedJTATransaction", getClreplaced().getClreplacedLoader());
}
19
View Source File : JdbcClientDetailsService.java
License : Apache License 2.0
Project Creator : MaxKeyTop
License : Apache License 2.0
Project Creator : MaxKeyTop
private static JsonMapper createJsonMapper() {
if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new Jackson2Mapper();
}
return new NotSupportedJsonMapper();
}
19
View Source File : JsonParserFactory.java
License : Apache License 2.0
Project Creator : MaxKeyTop
License : Apache License 2.0
Project Creator : MaxKeyTop
public static JsonParser create() {
if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new Jackson2JsonParser();
}
throw new IllegalStateException("No Jackson parser found. Please add Jackson to your clreplacedpath.");
}
19
View Source File : RedisClientDetailsService.java
License : Apache License 2.0
Project Creator : justimaging
License : Apache License 2.0
Project Creator : justimaging
/**
* json process
* @return
*/
private static JsonMapper createJsonMapper() {
if (ClreplacedUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", null)) {
return new JacksonMapper();
} else if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new Jackson2Mapper();
}
return new NotSupportedJsonMapper();
}
19
View Source File : JsonParserFactory.java
License : Apache License 2.0
Project Creator : hello-shf
License : Apache License 2.0
Project Creator : hello-shf
/**
* Static factory for the "best" JSON parser available on the clreplacedpath. Tries Jackson
* 2, then Gson, Snake YAML, Simple JSON, JSON (from eclipse), and then falls back to
* the {@link BasicJsonParser}.
*
* @return a {@link JsonParser}
*/
public static JsonParser getJsonParser() {
if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new JacksonJsonParser();
}
if (ClreplacedUtils.isPresent("com.google.gson.Gson", null)) {
return new GsonJsonParser();
}
if (ClreplacedUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) {
return new YamlJsonParser();
}
if (ClreplacedUtils.isPresent("org.json.simple.JSONObject", null)) {
return new JsonSimpleJsonParser();
}
return new BasicJsonParser();
}
19
View Source File : CloudSqlEnvironmentPostProcessor.java
License : Apache License 2.0
Project Creator : GoogleCloudPlatform
License : Apache License 2.0
Project Creator : GoogleCloudPlatform
private boolean isOnClreplacedpath(String clreplacedName) {
return ClreplacedUtils.isPresent(clreplacedName, null);
}
19
View Source File : ServiceProxyTst.java
License : Apache License 2.0
Project Creator : eclipse
License : Apache License 2.0
Project Creator : eclipse
public void testCglibLibraryVisibility() {
// note that cglib is not declared inside this bundle but should be seen
// by spring-core (which contains the util clreplacedes)
replacedertTrue(ClreplacedUtils.isPresent("org.springframework.cglib.proxy.Enhancer", ProxyFactory.clreplaced.getClreplacedLoader()));
}
19
View Source File : ServiceCollectionTest.java
License : Apache License 2.0
Project Creator : eclipse
License : Apache License 2.0
Project Creator : eclipse
public void testCGLIBAvailable() throws Exception {
replacedertTrue(ClreplacedUtils.isPresent("org.springframework.cglib.proxy.Enhancer", DefaultAopProxyFactory.clreplaced.getClreplacedLoader()));
}
19
View Source File : DubboServiceBeanMetadataResolver.java
License : Apache License 2.0
Project Creator : alibaba
License : Apache License 2.0
Project Creator : alibaba
private boolean isClreplacedPresent(String clreplacedName) {
return ClreplacedUtils.isPresent(clreplacedName, clreplacedLoader);
}
18
View Source File : CacheMetricsRegistrar.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private Cache unwrapIfNecessary(Cache cache) {
if (ClreplacedUtils.isPresent("org.springframework.cache.transaction.TransactionAwareCacheDecorator", getClreplaced().getClreplacedLoader())) {
return TransactionAwareCacheDecoratorHandler.unwrapIfNecessary(cache);
}
return cache;
}
18
View Source File : AbstractMessageBrokerConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Return an {@link org.springframework.validation.Validator} instance for
* validating {@code @Payload} method arguments.
* <p>In order, this method tries to get a Validator instance:
* <ul>
* <li>delegating to getValidator() first</li>
* <li>if none returned, getting an existing instance with its well-known name "mvcValidator",
* created by an MVC configuration</li>
* <li>if none returned, checking the clreplacedpath for the presence of a JSR-303 implementation
* before creating a {@code OptionalValidatorFactoryBean}</li>
* <li>returning a no-op Validator instance</li>
* </ul>
*/
protected Validator simpValidator() {
Validator validator = getValidator();
if (validator == null) {
if (this.applicationContext != null && this.applicationContext.containsBean(MVC_VALIDATOR_NAME)) {
validator = this.applicationContext.getBean(MVC_VALIDATOR_NAME, Validator.clreplaced);
} else if (ClreplacedUtils.isPresent("javax.validation.Validator", getClreplaced().getClreplacedLoader())) {
Clreplaced<?> clazz;
try {
String clreplacedName = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClreplacedUtils.forName(clreplacedName, AbstractMessageBrokerConfiguration.clreplaced.getClreplacedLoader());
} catch (Throwable ex) {
throw new BeanInitializationException("Could not find default validator clreplaced", ex);
}
validator = (Validator) BeanUtils.instantiateClreplaced(clazz);
} else {
validator = new Validator() {
@Override
public boolean supports(Clreplaced<?> clazz) {
return false;
}
@Override
public void validate(@Nullable Object target, Errors errors) {
}
};
}
}
return validator;
}
18
View Source File : LoadTimeWeaverBeanDefinitionParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
protected boolean isBeanConfigurerAspectEnabled(@Nullable ClreplacedLoader beanClreplacedLoader) {
return ClreplacedUtils.isPresent(SpringConfiguredBeanDefinitionParser.BEAN_CONFIGURER_ASPECT_CLreplaced_NAME, beanClreplacedLoader);
}
18
View Source File : Target_JsonParserFactory.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
@Subsreplacedute
public static JsonParser getJsonParser() {
if (ClreplacedUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
return new JacksonJsonParser();
}
if (ClreplacedUtils.isPresent("com.google.gson.Gson", null)) {
return new GsonJsonParser();
}
return new BasicJsonParser();
}
18
View Source File : ThinJarAppWrapper.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
private void reset() {
if (ClreplacedUtils.isPresent("org.apache.catalina.webresources.TomcatURLStreamHandlerFactory", null)) {
setField(ClreplacedUtils.resolveClreplacedName("org.apache.catalina.webresources.TomcatURLStreamHandlerFactory", null), "instance", null);
setField(URL.clreplaced, "factory", null);
}
}
18
View Source File : AWSLambdaUtils.java
License : Apache License 2.0
Project Creator : spring-cloud
License : Apache License 2.0
Project Creator : spring-cloud
private static boolean isAPIGatewayProxyRequestEventPresent() {
return ClreplacedUtils.isPresent("com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent", ClreplacedUtils.getDefaultClreplacedLoader());
}
18
View Source File : AbstractMessageBrokerConfiguration.java
License : MIT License
Project Creator : mindcarver
License : MIT License
Project Creator : mindcarver
/**
* Return a {@link org.springframework.validation.Validator
* org.springframework.validation.Validators} instance for validating
* {@code @Payload} method arguments.
* <p>In order, this method tries to get a Validator instance:
* <ul>
* <li>delegating to getValidator() first</li>
* <li>if none returned, getting an existing instance with its well-known name "mvcValidator",
* created by an MVC configuration</li>
* <li>if none returned, checking the clreplacedpath for the presence of a JSR-303 implementation
* before creating a {@code OptionalValidatorFactoryBean}</li>
* <li>returning a no-op Validator instance</li>
* </ul>
*/
protected Validator simpValidator() {
Validator validator = getValidator();
if (validator == null) {
if (this.applicationContext != null && this.applicationContext.containsBean(MVC_VALIDATOR_NAME)) {
validator = this.applicationContext.getBean(MVC_VALIDATOR_NAME, Validator.clreplaced);
} else if (ClreplacedUtils.isPresent("javax.validation.Validator", getClreplaced().getClreplacedLoader())) {
Clreplaced<?> clazz;
try {
String clreplacedName = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClreplacedUtils.forName(clreplacedName, AbstractMessageBrokerConfiguration.clreplaced.getClreplacedLoader());
} catch (Throwable ex) {
throw new BeanInitializationException("Could not find default validator clreplaced", ex);
}
validator = (Validator) BeanUtils.instantiateClreplaced(clazz);
} else {
validator = new Validator() {
@Override
public boolean supports(Clreplaced<?> clazz) {
return false;
}
@Override
public void validate(@Nullable Object target, Errors errors) {
}
};
}
}
return validator;
}
18
View Source File : AbstractMessageBrokerConfiguration.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Return a {@link org.springframework.validation.Validator}s instance for validating
* {@code @Payload} method arguments.
* <p>In order, this method tries to get a Validator instance:
* <ul>
* <li>delegating to getValidator() first</li>
* <li>if none returned, getting an existing instance with its well-known name "mvcValidator",
* created by an MVC configuration</li>
* <li>if none returned, checking the clreplacedpath for the presence of a JSR-303 implementation
* before creating a {@code OptionalValidatorFactoryBean}</li>
* <li>returning a no-op Validator instance</li>
* </ul>
*/
protected Validator simpValidator() {
Validator validator = getValidator();
if (validator == null) {
if (this.applicationContext.containsBean(MVC_VALIDATOR_NAME)) {
validator = this.applicationContext.getBean(MVC_VALIDATOR_NAME, Validator.clreplaced);
} else if (ClreplacedUtils.isPresent("javax.validation.Validator", getClreplaced().getClreplacedLoader())) {
Clreplaced<?> clazz;
try {
String clreplacedName = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClreplacedUtils.forName(clreplacedName, AbstractMessageBrokerConfiguration.clreplaced.getClreplacedLoader());
} catch (Throwable ex) {
throw new BeanInitializationException("Could not find default validator clreplaced", ex);
}
validator = (Validator) BeanUtils.instantiate(clazz);
} else {
validator = new Validator() {
@Override
public boolean supports(Clreplaced<?> clazz) {
return false;
}
@Override
public void validate(Object target, Errors errors) {
}
};
}
}
return validator;
}
18
View Source File : LoadTimeWeaverBeanDefinitionParser.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
protected boolean isBeanConfigurerAspectEnabled(ClreplacedLoader beanClreplacedLoader) {
return ClreplacedUtils.isPresent(SpringConfiguredBeanDefinitionParser.BEAN_CONFIGURER_ASPECT_CLreplaced_NAME, beanClreplacedLoader);
}
17
View Source File : HttpMessageConverters.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private List<HttpMessageConverter<?>> getDefaultConverters() {
List<HttpMessageConverter<?>> converters = new ArrayList<>();
if (ClreplacedUtils.isPresent("org.springframework.web.servlet.config.annotation." + "WebMvcConfigurationSupport", null)) {
converters.addAll(new WebMvcConfigurationSupport() {
public List<HttpMessageConverter<?>> defaultMessageConverters() {
return super.getMessageConverters();
}
}.defaultMessageConverters());
} else {
converters.addAll(new RestTemplate().getMessageConverters());
}
reorderXmlConvertersToEnd(converters);
return converters;
}
17
View Source File : TomcatErrorPage.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private Object createNativePage() {
try {
if (ClreplacedUtils.isPresent(ERROR_PAGE_CLreplaced, null)) {
return BeanUtils.instantiateClreplaced(ClreplacedUtils.forName(ERROR_PAGE_CLreplaced, null));
}
} catch (ClreplacedNotFoundException | LinkageError ex) {
// Swallow and continue
}
return null;
}
17
View Source File : LoggingSystem.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
/**
* Detect and return the logging system in use. Supports Logback and Java Logging.
* @param clreplacedLoader the clreplacedloader
* @return the logging system
*/
public static LoggingSystem get(ClreplacedLoader clreplacedLoader) {
String loggingSystem = System.getProperty(SYSTEM_PROPERTY);
if (StringUtils.hasLength(loggingSystem)) {
if (NONE.equals(loggingSystem)) {
return new NoOpLoggingSystem();
}
return get(clreplacedLoader, loggingSystem);
}
return SYSTEMS.entrySet().stream().filter((entry) -> ClreplacedUtils.isPresent(entry.getKey(), clreplacedLoader)).map((entry) -> get(clreplacedLoader, entry.getValue())).findFirst().orElseThrow(() -> new IllegalStateException("No suitable logging system located"));
}
17
View Source File : WebMvcConfigurationSupport.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Return a global {@link Validator} instance for example for validating
* {@code @ModelAttribute} and {@code @RequestBody} method arguments.
* Delegates to {@link #getValidator()} first and if that returns {@code null}
* checks the clreplacedpath for the presence of a JSR-303 implementations
* before creating a {@code OptionalValidatorFactoryBean}.If a JSR-303
* implementation is not available, a no-op {@link Validator} is returned.
*/
@Bean
public Validator mvcValidator() {
Validator validator = getValidator();
if (validator == null) {
if (ClreplacedUtils.isPresent("javax.validation.Validator", getClreplaced().getClreplacedLoader())) {
Clreplaced<?> clazz;
try {
String clreplacedName = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClreplacedUtils.forName(clreplacedName, WebMvcConfigurationSupport.clreplaced.getClreplacedLoader());
} catch (ClreplacedNotFoundException | LinkageError ex) {
throw new BeanInitializationException("Failed to resolve default validator clreplaced", ex);
}
validator = (Validator) BeanUtils.instantiateClreplaced(clazz);
} else {
validator = new NoOpValidator();
}
}
return validator;
}
17
View Source File : WebFluxConfigurationSupport.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Return a global {@link Validator} instance for example for validating
* {@code @RequestBody} method arguments.
* <p>Delegates to {@link #getValidator()} first. If that returns {@code null}
* checks the clreplacedpath for the presence of a JSR-303 implementations
* before creating a {@code OptionalValidatorFactoryBean}. If a JSR-303
* implementation is not available, a "no-op" {@link Validator} is returned.
*/
@Bean
public Validator webFluxValidator() {
Validator validator = getValidator();
if (validator == null) {
if (ClreplacedUtils.isPresent("javax.validation.Validator", getClreplaced().getClreplacedLoader())) {
Clreplaced<?> clazz;
try {
String name = "org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean";
clazz = ClreplacedUtils.forName(name, getClreplaced().getClreplacedLoader());
} catch (ClreplacedNotFoundException | LinkageError ex) {
throw new BeanInitializationException("Failed to resolve default validator clreplaced", ex);
}
validator = (Validator) BeanUtils.instantiateClreplaced(clazz);
} else {
validator = new NoOpValidator();
}
}
return validator;
}
17
View Source File : ConditionServiceGenerator.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
public void process(Clreplaced<?> application, Set<JavaFile> files) {
if (ClreplacedUtils.isPresent(application.getName().replace("$", "_") + "Initializer", null)) {
files.add(JavaFile.builder(ClreplacedUtils.getPackageName(application), generate(application)).build());
}
}
17
View Source File : DefaultTypeService.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
@Override
public boolean isPresent(String name) {
if (types.containsKey(name)) {
return true;
}
return ClreplacedUtils.isPresent(name, clreplacedLoader);
}
17
View Source File : FunctionExporterInitializer.java
License : Apache License 2.0
Project Creator : spring-cloud
License : Apache License 2.0
Project Creator : spring-cloud
private boolean isExporting(GenericApplicationContext context) {
Boolean enabled = context.getEnvironment().getProperty("spring.cloud.function.web.export.enabled", Boolean.clreplaced);
if (enabled != null) {
return enabled;
}
if (ClreplacedUtils.isPresent("org.springframework.web.context.WebApplicationContext", getClreplaced().getClreplacedLoader())) {
if (context instanceof WebApplicationContext || context instanceof ReactiveWebApplicationContext || context.getEnvironment() instanceof ConfigurableWebEnvironment || context.getEnvironment() instanceof ConfigurableReactiveWebEnvironment) {
return false;
}
}
return true;
}
17
View Source File : FunctionExporterInitializer.java
License : Apache License 2.0
Project Creator : spring-cloud
License : Apache License 2.0
Project Creator : spring-cloud
private void registerWebClient(GenericApplicationContext context) {
if (ClreplacedUtils.isPresent("org.springframework.web.reactive.function.client.WebClient", getClreplaced().getClreplacedLoader())) {
if (context.getBeanFactory().getBeanNamesForType(WebClient.Builder.clreplaced, false, false).length == 0) {
context.registerBean(WebClient.Builder.clreplaced, new Supplier<WebClient.Builder>() {
@Override
public Builder get() {
return WebClient.builder();
}
});
}
}
}
17
View Source File : OpenTracingChannelInterceptor.java
License : Apache License 2.0
Project Creator : opentracing-contrib
License : Apache License 2.0
Project Creator : opentracing-contrib
protected String getChannelName(MessageChannel messageChannel) {
String name = null;
if (ClreplacedUtils.isPresent("org.springframework.integration.context.IntegrationObjectSupport", null)) {
if (messageChannel instanceof IntegrationObjectSupport) {
name = ((IntegrationObjectSupport) messageChannel).getComponentName();
}
if (name == null && messageChannel instanceof AbstractMessageChannel) {
name = ((AbstractMessageChannel) messageChannel).getFullChannelName();
}
}
if (name == null) {
return messageChannel.toString();
}
return name;
}
17
View Source File : ClassLoaderService.java
License : MIT License
Project Creator : lzpeng723
License : MIT License
Project Creator : lzpeng723
/**
* 获取类信息
* @param clreplacedName 类名
* @return
* @throws IOException
*/
public ClreplacedInfo getClreplacedInfo(String clreplacedName) throws IOException {
if (ClreplacedUtils.isPresent(clreplacedName, null)) {
return getClreplacedInfo(ClreplacedLoaderUtil.loadClreplaced(clreplacedName, false));
}
// 没有找到此类
return ClreplacedInfo.create(null, null, null, getClreplacedLoaders());
}
See More Examples