Consistent license header
This commit is contained in:
parent
d695f65e7c
commit
537193a4e0
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,14 +27,16 @@ import org.springframework.context.annotation.Import;
|
|||
import org.springframework.core.Ordered;
|
||||
|
||||
/**
|
||||
* Enables Spring's annotation-driven cache management capability, similar to
|
||||
* the support found in Spring's {@code <cache:*>} XML namespace. To be used together
|
||||
* Enables Spring's annotation-driven cache management capability, similar to the
|
||||
* support found in Spring's {@code <cache:*>} XML namespace. To be used together
|
||||
* with @{@link org.springframework.context.annotation.Configuration Configuration}
|
||||
* classes as follows:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableCaching
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public MyService myService() {
|
||||
* // configure and return a class having @Cacheable methods
|
||||
|
@ -52,11 +54,15 @@ import org.springframework.core.Ordered;
|
|||
*
|
||||
* <p>For reference, the example above can be compared to the following Spring XML
|
||||
* configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <cache:annotation-driven/>
|
||||
*
|
||||
* <bean id="myService" class="com.foo.MyService"/>
|
||||
*
|
||||
* <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
|
||||
* <property name="caches">
|
||||
* <set>
|
||||
|
@ -66,8 +72,10 @@ import org.springframework.core.Ordered;
|
|||
* </set>
|
||||
* </property>
|
||||
* </bean>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
* In both of the scenarios above, {@code @EnableCaching} and {@code
|
||||
* <cache:annotation-driven/>} are responsible for registering the necessary Spring
|
||||
* components that power annotation-driven cache management, such as the
|
||||
|
@ -90,12 +98,14 @@ import org.springframework.core.Ordered;
|
|||
*
|
||||
* <p>For those that wish to establish a more direct relationship between
|
||||
* {@code @EnableCaching} and the exact cache manager bean to be used,
|
||||
* the {@link CachingConfigurer} callback interface may be implemented - notice the
|
||||
* the {@code @Override}-annotated methods below:
|
||||
* the {@link CachingConfigurer} callback interface may be implemented.
|
||||
* Notice the the {@code @Override}-annotated methods below:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableCaching
|
||||
* public class AppConfig extends CachingConfigurerSupport {
|
||||
*
|
||||
* @Bean
|
||||
* public MyService myService() {
|
||||
* // configure and return a class having @Cacheable methods
|
||||
|
@ -118,6 +128,7 @@ import org.springframework.core.Ordered;
|
|||
* return new MyKeyGenerator();
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* This approach may be desirable simply because it is more explicit, or it may be
|
||||
* necessary in order to distinguish between two {@code CacheManager} beans present in the
|
||||
* same container.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -39,7 +39,8 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
* public MyBean myBean() {
|
||||
* // instantiate and configure MyBean obj
|
||||
* return obj;
|
||||
* }</pre>
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h3>Bean Names</h3>
|
||||
*
|
||||
|
@ -55,7 +56,8 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
* public MyBean myBean() {
|
||||
* // instantiate and configure MyBean obj
|
||||
* return obj;
|
||||
* }</pre>
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h3>Scope, DependsOn, Primary, and Lazy</h3>
|
||||
*
|
||||
|
@ -70,7 +72,8 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
* public MyBean myBean() {
|
||||
* // instantiate and configure MyBean obj
|
||||
* return obj;
|
||||
* }</pre>
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h3>{@code @Bean} Methods in {@code @Configuration} Classes</h3>
|
||||
*
|
||||
|
@ -87,14 +90,17 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public FooService fooService() {
|
||||
* return new FooService(fooRepository());
|
||||
* }
|
||||
*
|
||||
* @Bean
|
||||
* public FooRepository fooRepository() {
|
||||
* return new JdbcFooRepository(dataSource());
|
||||
* }
|
||||
*
|
||||
* // ...
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -152,7 +158,8 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
* @Bean
|
||||
* public static PropertyPlaceholderConfigurer ppc() {
|
||||
* // instantiate, configure and return ppc ...
|
||||
* }</pre>
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* By marking this method as {@code static}, it can be invoked without causing instantiation of its
|
||||
* declaring {@code @Configuration} class, thus avoiding the above-mentioned lifecycle conflicts.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,12 +27,14 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Indicates that a class declares one or more {@link Bean @Bean} methods and may be processed
|
||||
* by the Spring container to generate bean definitions and service requests for those
|
||||
* beans at runtime, for example:
|
||||
* Indicates that a class declares one or more {@link Bean @Bean} methods and
|
||||
* may be processed by the Spring container to generate bean definitions and
|
||||
* service requests for those beans at runtime, for example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public MyBean myBean() {
|
||||
* // instantiate, configure and return bean ...
|
||||
|
@ -40,25 +42,28 @@ import org.springframework.stereotype.Component;
|
|||
* }</pre>
|
||||
*
|
||||
* <h2>Bootstrapping {@code @Configuration} classes</h2>
|
||||
*
|
||||
* <h3>Via {@code AnnotationConfigApplicationContext}</h3>
|
||||
*
|
||||
* {@code @Configuration} classes are typically bootstrapped using either
|
||||
* {@link AnnotationConfigApplicationContext} or its web-capable variant,
|
||||
* {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext
|
||||
* AnnotationConfigWebApplicationContext}.
|
||||
* A simple example with the former follows:
|
||||
* AnnotationConfigWebApplicationContext}. A simple example with the former follows:
|
||||
*
|
||||
* <pre class="code">
|
||||
* AnnotationConfigApplicationContext ctx =
|
||||
* new AnnotationConfigApplicationContext();
|
||||
* AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
* ctx.register(AppConfig.class);
|
||||
* ctx.refresh();
|
||||
* MyBean myBean = ctx.getBean(MyBean.class);
|
||||
* // use myBean ...</pre>
|
||||
* // use myBean ...
|
||||
* </pre>
|
||||
*
|
||||
* See {@link AnnotationConfigApplicationContext} Javadoc for further details and see
|
||||
* {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext
|
||||
* AnnotationConfigWebApplicationContext} for {@code web.xml} configuration instructions.
|
||||
*
|
||||
* <h3>Via Spring {@code <beans>} XML</h3>
|
||||
*
|
||||
* <p>As an alternative to registering {@code @Configuration} classes directly against an
|
||||
* {@code AnnotationConfigApplicationContext}, {@code @Configuration} classes may be
|
||||
* declared as normal {@code <bean>} definitions within Spring XML files:
|
||||
|
@ -74,6 +79,7 @@ import org.springframework.stereotype.Component;
|
|||
* post processors that facilitate handling {@code @Configuration} classes.
|
||||
*
|
||||
* <h3>Via component scanning</h3>
|
||||
*
|
||||
* <p>{@code @Configuration} is meta-annotated with {@link Component @Component}, therefore
|
||||
* {@code @Configuration} classes are candidates for component scanning (typically using
|
||||
* Spring XML's {@code <context:component-scan/>} element) and therefore may also take
|
||||
|
@ -82,6 +88,7 @@ import org.springframework.stereotype.Component;
|
|||
* <p>{@code @Configuration} classes may not only be bootstrapped using
|
||||
* component scanning, but may also themselves <em>configure</em> component scanning using
|
||||
* the {@link ComponentScan @ComponentScan} annotation:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @ComponentScan("com.acme.app.services")
|
||||
|
@ -89,18 +96,20 @@ import org.springframework.stereotype.Component;
|
|||
* // various @Bean definitions ...
|
||||
* }</pre>
|
||||
*
|
||||
* See {@link ComponentScan @ComponentScan} Javadoc for details.
|
||||
*
|
||||
* See the {@link ComponentScan @ComponentScan} javadoc for details.
|
||||
*
|
||||
* <h2>Working with externalized values</h2>
|
||||
*
|
||||
* <h3>Using the {@code Environment} API</h3>
|
||||
*
|
||||
* Externalized values may be looked up by injecting the Spring
|
||||
* {@link org.springframework.core.env.Environment Environment} into a
|
||||
* {@code @Configuration} class using the {@code @Autowired} or the {@code @Inject}
|
||||
* annotation:
|
||||
* {@link org.springframework.core.env.Environment} into a {@code @Configuration}
|
||||
* class using the {@code @Autowired} or the {@code @Inject} annotation:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject Environment env;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -115,10 +124,12 @@ import org.springframework.stereotype.Component;
|
|||
* source" objects, and {@code @Configuration} classes may contribute property sources to
|
||||
* the {@code Environment} object using
|
||||
* the {@link org.springframework.core.env.PropertySources @PropertySources} annotation:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @PropertySource("classpath:/com/acme/app.properties")
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject Environment env;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -131,12 +142,15 @@ import org.springframework.stereotype.Component;
|
|||
* and {@link PropertySource @PropertySource} Javadoc for further details.
|
||||
*
|
||||
* <h3>Using the {@code @Value} annotation</h3>
|
||||
*
|
||||
* Externalized values may be 'wired into' {@code @Configuration} classes using
|
||||
* the {@link Value @Value} annotation:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @PropertySource("classpath:/com/acme/app.properties")
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Value("${bean.name}") String beanName;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -155,14 +169,18 @@ import org.springframework.stereotype.Component;
|
|||
* {@code PropertySourcesPlaceholderConfigurer}.
|
||||
*
|
||||
* <h2>Composing {@code @Configuration} classes</h2>
|
||||
*
|
||||
* <h3>With the {@code @Import} annotation</h3>
|
||||
*
|
||||
* <p>{@code @Configuration} classes may be composed using the {@link Import @Import} annotation,
|
||||
* not unlike the way that {@code <import>} works in Spring XML. Because
|
||||
* {@code @Configuration} objects are managed as Spring beans within the container,
|
||||
* imported configurations may be injected using {@code @Autowired} or {@code @Inject}:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class DatabaseConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public DataSource dataSource() {
|
||||
* // instantiate, configure and return DataSource
|
||||
|
@ -172,6 +190,7 @@ import org.springframework.stereotype.Component;
|
|||
* @Configuration
|
||||
* @Import(DatabaseConfig.class)
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject DatabaseConfig dataConfig;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -188,13 +207,15 @@ import org.springframework.stereotype.Component;
|
|||
* new AnnotationConfigApplicationContext(AppConfig.class);</pre>
|
||||
*
|
||||
* <h3>With the {@code @Profile} annotation</h3>
|
||||
*
|
||||
* {@code @Configuration} classes may be marked with the {@link Profile @Profile} annotation to
|
||||
* indicate they should be processed only if a given profile or profiles are
|
||||
* <em>active</em>:
|
||||
* indicate they should be processed only if a given profile or profiles are <em>active</em>:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Profile("embedded")
|
||||
* @Configuration
|
||||
* public class EmbeddedDatabaseConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public DataSource dataSource() {
|
||||
* // instantiate, configure and return embedded DataSource
|
||||
|
@ -204,25 +225,29 @@ import org.springframework.stereotype.Component;
|
|||
* @Profile("production")
|
||||
* @Configuration
|
||||
* public class ProductionDatabaseConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public DataSource dataSource() {
|
||||
* // instantiate, configure and return production DataSource
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* See {@link Profile @Profile} and {@link org.springframework.core.env.Environment Environment}
|
||||
* Javadoc for further details.
|
||||
* See the {@link Profile @Profile} and {@link org.springframework.core.env.Environment}
|
||||
* javadocs for further details.
|
||||
*
|
||||
* <h3>With Spring XML using the {@code @ImportResource} annotation</h3>
|
||||
*
|
||||
* As mentioned above, {@code @Configuration} classes may be declared as regular Spring
|
||||
* {@code <bean>} definitions within Spring XML files. It is also possible to
|
||||
* import Spring XML configuration files into {@code @Configuration} classes using
|
||||
* the {@link ImportResource @ImportResource} annotation. Bean definitions imported from XML can be
|
||||
* injected using {@code @Autowired} or {@code @Inject}:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @ImportResource("classpath:/com/acme/database-config.xml")
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject DataSource dataSource; // from XML
|
||||
*
|
||||
* @Bean
|
||||
|
@ -233,10 +258,13 @@ import org.springframework.stereotype.Component;
|
|||
* }</pre>
|
||||
*
|
||||
* <h3>With nested {@code @Configuration} classes</h3>
|
||||
*
|
||||
* {@code @Configuration} classes may be nested within one another as follows:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject DataSource dataSource;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -264,6 +292,7 @@ import org.springframework.stereotype.Component;
|
|||
* enclosing {@code @Configuration} class.
|
||||
*
|
||||
* <h2>Configuring lazy initialization</h2>
|
||||
*
|
||||
* <p>By default, {@code @Bean} methods will be <em>eagerly instantiated</em> at container
|
||||
* bootstrap time. To avoid this, {@code @Configuration} may be used in conjunction with
|
||||
* the {@link Lazy @Lazy} annotation to indicate that all {@code @Bean} methods declared within
|
||||
|
@ -271,9 +300,11 @@ import org.springframework.stereotype.Component;
|
|||
* individual {@code @Bean} methods as well.
|
||||
*
|
||||
* <h2>Testing support for {@code @Configuration} classes</h2>
|
||||
*
|
||||
* The Spring <em>TestContext framework</em> available in the {@code spring-test} module
|
||||
* provides the {@code @ContextConfiguration} annotation, which as of Spring 3.1 can
|
||||
* accept an array of {@code @Configuration} {@code Class} objects:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @RunWith(SpringJUnit4ClassRunner.class)
|
||||
* @ContextConfiguration(classes={AppConfig.class, DatabaseConfig.class})
|
||||
|
@ -292,6 +323,7 @@ import org.springframework.stereotype.Component;
|
|||
* See TestContext framework reference documentation for details.
|
||||
*
|
||||
* <h2>Enabling built-in Spring features using {@code @Enable} annotations</h2>
|
||||
*
|
||||
* Spring features such as asynchronous method execution, scheduled task execution,
|
||||
* annotation driven transaction management, and even Spring MVC can be enabled and
|
||||
* configured from {@code @Configuration}
|
||||
|
@ -304,6 +336,7 @@ import org.springframework.stereotype.Component;
|
|||
* for details.
|
||||
*
|
||||
* <h2>Constraints when authoring {@code @Configuration} classes</h2>
|
||||
*
|
||||
* <ul>
|
||||
* <li>@Configuration classes must be non-final
|
||||
* <li>@Configuration classes must be non-local (may not be declared within a method)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -31,6 +31,7 @@ import java.lang.annotation.Target;
|
|||
* @Configuration
|
||||
* @EnableAspectJAutoProxy
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public FooService fooService() {
|
||||
* return new FooService();
|
||||
|
@ -47,12 +48,14 @@ import java.lang.annotation.Target;
|
|||
*
|
||||
* <pre class="code">
|
||||
* public class FooService {
|
||||
*
|
||||
* // various methods
|
||||
* }</pre>
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Aspect
|
||||
* public class MyAspect {
|
||||
*
|
||||
* @Before("execution(* FooService+.*(..))")
|
||||
* public void advice() {
|
||||
* // advise FooService methods as appropriate
|
||||
|
@ -66,6 +69,7 @@ import java.lang.annotation.Target;
|
|||
* <p>Users can control the type of proxy that gets created for {@code FooService} using
|
||||
* the {@link #proxyTargetClass()} attribute. The following enables CGLIB-style 'subclass'
|
||||
* proxies as opposed to the default interface-based JDK proxy approach.
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableAspectJAutoProxy(proxyTargetClass=true)
|
||||
|
@ -75,6 +79,7 @@ import java.lang.annotation.Target;
|
|||
*
|
||||
* <p>Note that {@code @Aspect} beans may be component-scanned like any other. Simply
|
||||
* mark the aspect with both {@code @Aspect} and {@code @Component}:
|
||||
*
|
||||
* <pre class="code">
|
||||
* package com.foo;
|
||||
*
|
||||
|
@ -86,11 +91,13 @@ import java.lang.annotation.Target;
|
|||
* public class MyAspect { ... }</pre>
|
||||
*
|
||||
* Then use the @{@link ComponentScan} annotation to pick both up:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @ComponentScan("com.foo")
|
||||
* @EnableAspectJAutoProxy
|
||||
* public class AppConfig {
|
||||
*
|
||||
* // no explicit @Bean definitions required
|
||||
* }</pre>
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -29,22 +29,28 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* Activates a Spring {@link LoadTimeWeaver} for this application context, available as
|
||||
* a bean with the name "loadTimeWeaver", similar to the {@code <context:load-time-weaver>}
|
||||
* element in Spring XML.
|
||||
* To be used
|
||||
* on @{@link org.springframework.context.annotation.Configuration Configuration} classes;
|
||||
*
|
||||
* <p>To be used on @{@link org.springframework.context.annotation.Configuration Configuration} classes;
|
||||
* the simplest possible example of which follows:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableLoadTimeWeaving
|
||||
* public class AppConfig {
|
||||
*
|
||||
* // application-specific @Bean definitions ...
|
||||
* }</pre>
|
||||
*
|
||||
* The example above is equivalent to the following Spring XML configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <context:load-time-weaver/>
|
||||
*
|
||||
* <!-- application-specific <bean> definitions -->
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -61,10 +67,12 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* {@code @EnableLoadTimeWeaving} may also implement the {@link LoadTimeWeavingConfigurer}
|
||||
* interface and return a custom {@code LoadTimeWeaver} instance through the
|
||||
* {@code #getLoadTimeWeaver} method:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableLoadTimeWeaving
|
||||
* public class AppConfig implements LoadTimeWeavingConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public LoadTimeWeaver getLoadTimeWeaver() {
|
||||
* MyLoadTimeWeaver ltw = new MyLoadTimeWeaver();
|
||||
|
@ -75,10 +83,13 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* }</pre>
|
||||
*
|
||||
* <p>The example above can be compared to the following Spring XML configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <context:load-time-weaver weaverClass="com.acme.MyLoadTimeWeaver"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -94,6 +105,7 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* be registered through {@link LoadTimeWeaver#addTransformer}. AspectJ weaving will be
|
||||
* activated by default if a "META-INF/aop.xml" resource is present on the classpath.
|
||||
* Example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableLoadTimeWeaving(aspectjWeaving=ENABLED)
|
||||
|
@ -101,10 +113,13 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* }</pre>
|
||||
*
|
||||
* <p>The example above can be compared to the following Spring XML configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <context:load-time-weaver aspectj-weaving="on"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -131,7 +146,8 @@ public @interface EnableLoadTimeWeaving {
|
|||
*/
|
||||
AspectJWeaving aspectjWeaving() default AspectJWeaving.AUTODETECT;
|
||||
|
||||
public enum AspectJWeaving {
|
||||
|
||||
enum AspectJWeaving {
|
||||
|
||||
/**
|
||||
* Switches on Spring-based AspectJ load-time weaving.
|
||||
|
@ -151,4 +167,5 @@ public @interface EnableLoadTimeWeaving {
|
|||
*/
|
||||
AUTODETECT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
|
|||
* conjunction with @{@link Configuration} classes.
|
||||
*
|
||||
* <h3>Example usage</h3>
|
||||
*
|
||||
* <p>Given a file {@code app.properties} containing the key/value pair
|
||||
* {@code testbean.name=myTestBean}, the following {@code @Configuration} class
|
||||
* uses {@code @PropertySource} to contribute {@code app.properties} to the
|
||||
|
@ -58,6 +59,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
|
|||
* the configuration above, a call to {@code testBean.getName()} will return "myTestBean".
|
||||
*
|
||||
* <h3>Resolving ${...} placeholders in {@code <bean>} and {@code @Value} annotations</h3>
|
||||
*
|
||||
* In order to resolve ${...} placeholders in {@code <bean>} definitions or {@code @Value}
|
||||
* annotations using properties from a {@code PropertySource}, one must register
|
||||
* a {@code PropertySourcesPlaceholderConfigurer}. This happens automatically when using
|
||||
|
@ -68,9 +70,11 @@ import org.springframework.core.io.support.PropertySourceFactory;
|
|||
* for details and examples.
|
||||
*
|
||||
* <h3>Resolving ${...} placeholders within {@code @PropertySource} resource locations</h3>
|
||||
*
|
||||
* Any ${...} placeholders present in a {@code @PropertySource} {@linkplain #value()
|
||||
* resource location} will be resolved against the set of property sources already
|
||||
* registered against the environment. For example:
|
||||
* registered against the environment. For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @PropertySource("classpath:/com/${my.placeholder:default/path}/app.properties")
|
||||
|
@ -94,6 +98,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
|
|||
* IllegalArgumentException} will be thrown.
|
||||
*
|
||||
* <h3>A note on property overriding with @PropertySource</h3>
|
||||
*
|
||||
* In cases where a given property key exists in more than one {@code .properties}
|
||||
* file, the last {@code @PropertySource} annotation processed will 'win' and override.
|
||||
*
|
||||
|
|
|
@ -64,8 +64,7 @@ import org.springframework.core.Ordered;
|
|||
* {@code void} return type cannot transmit any exception back to the caller. By default,
|
||||
* such uncaught exceptions are only logged.
|
||||
*
|
||||
* <p>To customize all this, implement {@link AsyncConfigurer} and
|
||||
* provide:
|
||||
* <p>To customize all this, implement {@link AsyncConfigurer} and provide:
|
||||
* <ul>
|
||||
* <li>your own {@link java.util.concurrent.Executor Executor} through the
|
||||
* {@link AsyncConfigurer#getAsyncExecutor getAsyncExecutor()} method, and</li>
|
||||
|
@ -114,13 +113,19 @@ import org.springframework.core.Ordered;
|
|||
*
|
||||
* <p>For reference, the example above can be compared to the following Spring XML
|
||||
* configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <task:annotation-driven executor="myExecutor" exception-handler="exceptionHandler"/>
|
||||
*
|
||||
* <task:executor id="myExecutor" pool-size="7-42" queue-capacity="11"/>
|
||||
*
|
||||
* <bean id="asyncBean" class="com.foo.MyAsyncBean"/>
|
||||
*
|
||||
* <bean id="exceptionHandler" class="com.foo.MyAsyncUncaughtExceptionHandler"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -148,8 +153,8 @@ public @interface EnableAsync {
|
|||
/**
|
||||
* Indicate the 'async' annotation type to be detected at either class
|
||||
* or method level.
|
||||
* <p>By default, both Spring's @{@link Async} annotation and the EJB
|
||||
* 3.1 {@code @javax.ejb.Asynchronous} annotation will be detected.
|
||||
* <p>By default, both Spring's @{@link Async} annotation and the EJB 3.1
|
||||
* {@code @javax.ejb.Asynchronous} annotation will be detected.
|
||||
* <p>This attribute exists so that developers can provide their own
|
||||
* custom annotation type to indicate that a method (or all methods of
|
||||
* a given class) should be invoked asynchronously.
|
||||
|
|
|
@ -163,18 +163,25 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
|||
*
|
||||
* <p>For reference, the example above can be compared to the following Spring XML
|
||||
* configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <task:annotation-driven scheduler="taskScheduler"/>
|
||||
*
|
||||
* <task:scheduler id="taskScheduler" pool-size="42"/>
|
||||
*
|
||||
* <task:scheduled-tasks scheduler="taskScheduler">
|
||||
* <task:scheduled ref="myTask" method="work" fixed-rate="1000"/>
|
||||
* </task:scheduled-tasks>
|
||||
*
|
||||
* <bean id="myTask" class="com.foo.MyTask"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
* the examples are equivalent save that in XML a <em>fixed-rate</em> period is used
|
||||
*
|
||||
* The examples are equivalent save that in XML a <em>fixed-rate</em> period is used
|
||||
* instead of a custom <em>{@code Trigger}</em> implementation; this is because the
|
||||
* {@code task:} namespace {@code scheduled} cannot easily expose such support. This is
|
||||
* but one demonstration how the code-based approach allows for maximum configurability
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aop.config;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.access;
|
||||
|
@ -22,7 +22,6 @@ import java.lang.reflect.Method;
|
|||
import java.net.BindException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.Descriptor;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.remote.JMXConnectorServer;
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.access;
|
||||
|
||||
import java.net.BindException;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
|
@ -43,6 +42,7 @@ import org.springframework.util.SocketUtils;
|
|||
public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTests {
|
||||
|
||||
private static final int SERVICE_PORT;
|
||||
|
||||
private static final String SERVICE_URL;
|
||||
|
||||
static {
|
||||
|
@ -50,10 +50,12 @@ public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTes
|
|||
SERVICE_URL = "service:jmx:jmxmp://localhost:" + SERVICE_PORT;
|
||||
}
|
||||
|
||||
|
||||
private JMXConnectorServer connectorServer;
|
||||
|
||||
private JMXConnector connector;
|
||||
|
||||
|
||||
@Override
|
||||
public void onSetUp() throws Exception {
|
||||
runTests = false;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export;
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.jmx.support.ObjectNameManager;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.annotation;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.annotation;
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.springframework.jmx.JmxTestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
@ -31,6 +31,7 @@ public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAsse
|
|||
|
||||
protected static final String OBJECT_NAME = "bean:name=testBean5";
|
||||
|
||||
|
||||
@Override
|
||||
protected String getObjectName() {
|
||||
return OBJECT_NAME;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
@ -33,6 +33,7 @@ public class MethodNameBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAss
|
|||
|
||||
protected static final String OBJECT_NAME = "bean:name=testBean4";
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetAgeIsReadOnly() throws Exception {
|
||||
ModelMBeanInfo info = getMBeanInfoFromAssembler();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
@ -33,6 +33,7 @@ public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssembler
|
|||
|
||||
protected static final String OBJECT_NAME = "bean:name=testBean5";
|
||||
|
||||
|
||||
@Override
|
||||
protected String getObjectName() {
|
||||
return OBJECT_NAME;
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.assembler;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
|
@ -26,6 +23,7 @@ public class ReflectiveAssemblerTests extends AbstractJmxAssemblerTests {
|
|||
|
||||
protected static final String OBJECT_NAME = "bean:name=testBean1";
|
||||
|
||||
|
||||
@Override
|
||||
protected String getObjectName() {
|
||||
return OBJECT_NAME;
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.naming;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.naming;
|
||||
|
@ -23,6 +23,7 @@ public class KeyNamingStrategyTests extends AbstractNamingStrategyTests {
|
|||
|
||||
private static final String OBJECT_NAME = "spring:name=test";
|
||||
|
||||
|
||||
@Override
|
||||
protected ObjectNamingStrategy getStrategy() throws Exception {
|
||||
return new KeyNamingStrategy();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.naming;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.export.naming;
|
||||
|
@ -26,6 +26,7 @@ public class PropertiesNamingStrategyTests extends AbstractNamingStrategyTests {
|
|||
|
||||
private static final String OBJECT_NAME = "bean:name=namingTest";
|
||||
|
||||
|
||||
@Override
|
||||
protected ObjectNamingStrategy getStrategy() throws Exception {
|
||||
KeyNamingStrategy strat = new KeyNamingStrategy();
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.support;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javax.management.InstanceNotFoundException;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerConnection;
|
||||
|
@ -49,6 +48,7 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
|||
|
||||
private static final String OBJECT_NAME = "spring:type=connector,name=test";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onSetUp() throws Exception {
|
||||
Assume.group(TestGroup.JMXMP);
|
||||
|
@ -60,6 +60,7 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
|||
Assume.group(TestGroup.JMXMP, () -> super.tearDown());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void startupWithLocatedServer() throws Exception {
|
||||
ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.support;
|
||||
|
@ -193,7 +193,7 @@ public class JmxUtilsTests {
|
|||
}
|
||||
|
||||
|
||||
public static interface FooMBean {
|
||||
public interface FooMBean {
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ public class JmxUtilsTests {
|
|||
}
|
||||
|
||||
|
||||
public static interface FooMXBean {
|
||||
public interface FooMXBean {
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
@ -224,37 +224,30 @@ public class JmxUtilsTests {
|
|||
|
||||
|
||||
public static class Bar extends Foo {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class Abc extends Bar {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static interface JmxInterfaceMBean {
|
||||
|
||||
private interface JmxInterfaceMBean {
|
||||
}
|
||||
|
||||
|
||||
private static interface JmxInterface extends JmxInterfaceMBean {
|
||||
|
||||
private interface JmxInterface extends JmxInterfaceMBean {
|
||||
}
|
||||
|
||||
|
||||
private static interface SpecializedJmxInterface extends JmxInterface {
|
||||
|
||||
private interface SpecializedJmxInterface extends JmxInterface {
|
||||
}
|
||||
|
||||
|
||||
private static interface JmxClassMBean {
|
||||
|
||||
private interface JmxClassMBean {
|
||||
}
|
||||
|
||||
|
||||
private static class JmxClass implements JmxClassMBean {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jmx.support;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerFactory;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
|
|||
* {@code OptionSet} in the case of {@link JOptCommandLinePropertySource}.
|
||||
*
|
||||
* <h3>Purpose and General Usage</h3>
|
||||
*
|
||||
* For use in standalone Spring-based applications, i.e. those that are bootstrapped via
|
||||
* a traditional {@code main} method accepting a {@code String[]} of arguments from the
|
||||
* command line. In many cases, processing command-line arguments directly within the
|
||||
|
@ -38,6 +39,7 @@ import org.springframework.util.StringUtils;
|
|||
* will typically be added to the {@link Environment} of the Spring
|
||||
* {@code ApplicationContext}, at which point all command line arguments become available
|
||||
* through the {@link Environment#getProperty(String)} family of methods. For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* public static void main(String[] args) {
|
||||
* CommandLinePropertySource clps = ...;
|
||||
|
@ -46,11 +48,14 @@ import org.springframework.util.StringUtils;
|
|||
* ctx.register(AppConfig.class);
|
||||
* ctx.refresh();
|
||||
* }</pre>
|
||||
*
|
||||
* With the bootstrap logic above, the {@code AppConfig} class may {@code @Inject} the
|
||||
* Spring {@code Environment} and query it directly for properties:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Inject Environment env;
|
||||
*
|
||||
* @Bean
|
||||
|
@ -63,6 +68,7 @@ import org.springframework.util.StringUtils;
|
|||
* return dataSource;
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* Because the {@code CommandLinePropertySource} was added to the {@code Environment}'s
|
||||
* set of {@link MutablePropertySources} using the {@code #addFirst} method, it has
|
||||
* highest search precedence, meaning that while "db.hostname" and other properties may
|
||||
|
@ -75,9 +81,11 @@ import org.springframework.util.StringUtils;
|
|||
* annotation may be used to inject these properties, given that a {@link
|
||||
* PropertySourcesPropertyResolver} bean has been registered, either directly or through
|
||||
* using the {@code <context:property-placeholder>} element. For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Component
|
||||
* public class MyComponent {
|
||||
*
|
||||
* @Value("my.property:defaultVal")
|
||||
* private String myProperty;
|
||||
*
|
||||
|
@ -94,10 +102,12 @@ import org.springframework.util.StringUtils;
|
|||
* {@link PropertySource#getProperty(String)} and
|
||||
* {@link PropertySource#containsProperty(String)} methods. For example, given the
|
||||
* following command line:
|
||||
* <pre class="code">
|
||||
* --o1=v1 --o2</pre>
|
||||
*
|
||||
* <pre class="code">--o1=v1 --o2</pre>
|
||||
*
|
||||
* 'o1' and 'o2' are treated as "option arguments", and the following assertions would
|
||||
* evaluate true:
|
||||
*
|
||||
* <pre class="code">
|
||||
* CommandLinePropertySource<?> ps = ...
|
||||
* assert ps.containsProperty("o1") == true;
|
||||
|
@ -105,7 +115,8 @@ import org.springframework.util.StringUtils;
|
|||
* assert ps.containsProperty("o3") == false;
|
||||
* assert ps.getProperty("o1").equals("v1");
|
||||
* assert ps.getProperty("o2").equals("");
|
||||
* assert ps.getProperty("o3") == null;</pre>
|
||||
* assert ps.getProperty("o3") == null;
|
||||
* </pre>
|
||||
*
|
||||
* Note that the 'o2' option has no argument, but {@code getProperty("o2")} resolves to
|
||||
* empty string ({@code ""}) as opposed to {@code null}, while {@code getProperty("o3")}
|
||||
|
@ -129,11 +140,13 @@ import org.springframework.util.StringUtils;
|
|||
* CommandLinePropertySource} and at the same time lends itself to conversion when used
|
||||
* in conjunction with the Spring {@link Environment} and its built-in {@code
|
||||
* ConversionService}. Consider the following example:
|
||||
* <pre class="code">
|
||||
* --o1=v1 --o2=v2 /path/to/file1 /path/to/file2</pre>
|
||||
*
|
||||
* <pre class="code">--o1=v1 --o2=v2 /path/to/file1 /path/to/file2</pre>
|
||||
*
|
||||
* In this example, "o1" and "o2" would be considered "option arguments", while the two
|
||||
* filesystem paths qualify as "non-option arguments". As such, the following assertions
|
||||
* will evaluate true:
|
||||
*
|
||||
* <pre class="code">
|
||||
* CommandLinePropertySource<?> ps = ...
|
||||
* assert ps.containsProperty("o1") == true;
|
||||
|
@ -141,22 +154,26 @@ import org.springframework.util.StringUtils;
|
|||
* assert ps.containsProperty("nonOptionArgs") == true;
|
||||
* assert ps.getProperty("o1").equals("v1");
|
||||
* assert ps.getProperty("o2").equals("v2");
|
||||
* assert ps.getProperty("nonOptionArgs").equals("/path/to/file1,/path/to/file2");</pre>
|
||||
* assert ps.getProperty("nonOptionArgs").equals("/path/to/file1,/path/to/file2");
|
||||
* </pre>
|
||||
*
|
||||
* <p>As mentioned above, when used in conjunction with the Spring {@code Environment}
|
||||
* abstraction, this comma-delimited string may easily be converted to a String array or
|
||||
* list:
|
||||
*
|
||||
* <pre class="code">
|
||||
* Environment env = applicationContext.getEnvironment();
|
||||
* String[] nonOptionArgs = env.getProperty("nonOptionArgs", String[].class);
|
||||
* assert nonOptionArgs[0].equals("/path/to/file1");
|
||||
* assert nonOptionArgs[1].equals("/path/to/file2");</pre>
|
||||
* assert nonOptionArgs[1].equals("/path/to/file2");
|
||||
* </pre>
|
||||
*
|
||||
* <p>The name of the special "non-option arguments" property may be customized through
|
||||
* the {@link #setNonOptionArgsPropertyName(String)} method. Doing so is recommended as
|
||||
* it gives proper semantic value to non-option arguments. For example, if filesystem
|
||||
* paths are being specified as non-option arguments, it is likely preferable to refer to
|
||||
* these as something like "file.locations" than the default of "nonOptionArgs":
|
||||
*
|
||||
* <pre class="code">
|
||||
* public static void main(String[] args) {
|
||||
* CommandLinePropertySource clps = ...;
|
||||
|
@ -169,6 +186,7 @@ import org.springframework.util.StringUtils;
|
|||
* }</pre>
|
||||
*
|
||||
* <h3>Limitations</h3>
|
||||
*
|
||||
* This abstraction is not intended to expose the full power of underlying command line
|
||||
* parsing APIs such as JOpt or Commons CLI. It's intent is rather just the opposite: to
|
||||
* provide the simplest possible abstraction for accessing command line arguments
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.util;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.jdbc.object;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -35,6 +35,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @Configuration
|
||||
* @EnableJms
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public DefaultJmsListenerContainerFactory myJmsListenerContainerFactory() {
|
||||
* DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
||||
|
@ -43,6 +44,7 @@ import org.springframework.context.annotation.Import;
|
|||
* factory.setConcurrency("5");
|
||||
* return factory;
|
||||
* }
|
||||
*
|
||||
* // other @Bean definitions
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -59,6 +61,7 @@ import org.springframework.context.annotation.Import;
|
|||
* package com.acme.foo;
|
||||
*
|
||||
* public class MyService {
|
||||
*
|
||||
* @JmsListener(containerFactory = "myJmsListenerContainerFactory", destination="myQueue")
|
||||
* public void process(String msg) {
|
||||
* // process incoming message
|
||||
|
@ -78,6 +81,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @Configuration
|
||||
* @EnableJms
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public MyService myService() {
|
||||
* return new MyService();
|
||||
|
@ -112,10 +116,9 @@ import org.springframework.context.annotation.Import;
|
|||
* // process incoming message
|
||||
* }</pre>
|
||||
*
|
||||
* These features are abstracted by the {@link org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory
|
||||
* MessageHandlerMethodFactory} that is responsible to build the necessary invoker to process
|
||||
* the annotated method. By default, {@link org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory
|
||||
* DefaultMessageHandlerMethodFactory} is used.
|
||||
* These features are abstracted by the {@link org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory}
|
||||
* that is responsible to build the necessary invoker to process the annotated method. By default,
|
||||
* {@link org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory} is used.
|
||||
*
|
||||
* <p>When more control is desired, a {@code @Configuration} class may implement
|
||||
* {@link JmsListenerConfigurer}. This allows access to the underlying
|
||||
|
@ -127,6 +130,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @Configuration
|
||||
* @EnableJms
|
||||
* public class AppConfig implements JmsListenerConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
|
||||
* registrar.setContainerFactory(myJmsListenerContainerFactory());
|
||||
|
@ -145,16 +149,18 @@ import org.springframework.context.annotation.Import;
|
|||
*
|
||||
* For reference, the example above can be compared to the following Spring XML
|
||||
* configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code <beans>
|
||||
*
|
||||
* <jms:annotation-driven container-factory="myJmsListenerContainerFactory"/>
|
||||
*
|
||||
* <bean id="myJmsListenerContainerFactory"
|
||||
* class="org.springframework.jms.config.DefaultJmsListenerContainerFactory">
|
||||
* <bean id="myJmsListenerContainerFactory" class="org.springframework.jms.config.DefaultJmsListenerContainerFactory">
|
||||
* // factory settings
|
||||
* </bean>
|
||||
*
|
||||
* <bean id="myService" class="com.acme.foo.MyService"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -169,6 +175,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @Configuration
|
||||
* @EnableJms
|
||||
* public class AppConfig implements JmsListenerConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
|
||||
* registrar.setEndpointRegistry(myJmsListenerEndpointRegistry());
|
||||
|
@ -197,6 +204,7 @@ import org.springframework.context.annotation.Import;
|
|||
* configuration:
|
||||
* <pre class="code">
|
||||
* {@code <beans>
|
||||
*
|
||||
* <jms:annotation-driven registry="myJmsListenerEndpointRegistry"
|
||||
* handler-method-factory="myJmsHandlerMethodFactory"/>
|
||||
*
|
||||
|
@ -211,6 +219,7 @@ import org.springframework.context.annotation.Import;
|
|||
* </bean>
|
||||
*
|
||||
* <bean id="myService" class="com.acme.foo.MyService"/>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
|
@ -222,6 +231,7 @@ import org.springframework.context.annotation.Import;
|
|||
* @Configuration
|
||||
* @EnableJms
|
||||
* public class AppConfig implements JmsListenerConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
|
||||
* SimpleJmsListenerEndpoint myEndpoint = new SimpleJmsListenerEndpoint();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
@ -44,6 +44,7 @@ final class MockWebResponseBuilder {
|
|||
|
||||
private static final String DEFAULT_STATUS_MESSAGE = "N/A";
|
||||
|
||||
|
||||
private final long startTime;
|
||||
|
||||
private final WebRequest webRequest;
|
||||
|
@ -59,6 +60,7 @@ final class MockWebResponseBuilder {
|
|||
this.response = response;
|
||||
}
|
||||
|
||||
|
||||
public WebResponse build() throws IOException {
|
||||
WebResponseData webResponseData = webResponseData();
|
||||
long endTime = System.currentTimeMillis();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
@ -27,7 +27,9 @@ import com.gargoylesoftware.htmlunit.WebRequest;
|
|||
* <p>For example, if you would like to match on the domain {@code code.jquery.com},
|
||||
* you might want to use the following.
|
||||
*
|
||||
* <pre class="code">WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");</pre>
|
||||
* <pre class="code">
|
||||
* WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");
|
||||
* </pre>
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author Sam Brannen
|
||||
|
@ -38,6 +40,7 @@ public final class UrlRegexRequestMatcher implements WebRequestMatcher {
|
|||
|
||||
private final Pattern pattern;
|
||||
|
||||
|
||||
public UrlRegexRequestMatcher(String regex) {
|
||||
this.pattern = Pattern.compile(regex);
|
||||
}
|
||||
|
@ -46,6 +49,7 @@ public final class UrlRegexRequestMatcher implements WebRequestMatcher {
|
|||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean matches(WebRequest request) {
|
||||
String url = request.getUrl().toExternalForm();
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit.webdriver;
|
||||
|
@ -69,7 +69,7 @@ public class MockMvcHtmlUnitDriverBuilder extends MockMvcWebConnectionBuilderSup
|
|||
/**
|
||||
* Create a new {@code MockMvcHtmlUnitDriverBuilder} based on the supplied
|
||||
* {@link MockMvc} instance.
|
||||
* @param mockMvc the {@code MockMvc} instance to use; never {@code null}
|
||||
* @param mockMvc the {@code MockMvc} instance to use (never {@code null})
|
||||
* @return the MockMvcHtmlUnitDriverBuilder to customize
|
||||
*/
|
||||
public static MockMvcHtmlUnitDriverBuilder mockMvcSetup(MockMvc mockMvc) {
|
||||
|
@ -81,7 +81,7 @@ public class MockMvcHtmlUnitDriverBuilder extends MockMvcWebConnectionBuilderSup
|
|||
* Create a new {@code MockMvcHtmlUnitDriverBuilder} based on the supplied
|
||||
* {@link WebApplicationContext}.
|
||||
* @param context the {@code WebApplicationContext} to create a {@link MockMvc}
|
||||
* instance from; never {@code null}
|
||||
* instance from (never {@code null})
|
||||
* @return the MockMvcHtmlUnitDriverBuilder to customize
|
||||
*/
|
||||
public static MockMvcHtmlUnitDriverBuilder webAppContextSetup(WebApplicationContext context) {
|
||||
|
@ -93,8 +93,8 @@ public class MockMvcHtmlUnitDriverBuilder extends MockMvcWebConnectionBuilderSup
|
|||
* Create a new {@code MockMvcHtmlUnitDriverBuilder} based on the supplied
|
||||
* {@link WebApplicationContext} and {@link MockMvcConfigurer}.
|
||||
* @param context the {@code WebApplicationContext} to create a {@link MockMvc}
|
||||
* instance from; never {@code null}
|
||||
* @param configurer the {@code MockMvcConfigurer} to apply; never {@code null}
|
||||
* instance from (never {@code null})
|
||||
* @param configurer the {@code MockMvcConfigurer} to apply (never {@code null})
|
||||
* @return the MockMvcHtmlUnitDriverBuilder to customize
|
||||
*/
|
||||
public static MockMvcHtmlUnitDriverBuilder webAppContextSetup(WebApplicationContext context,
|
||||
|
@ -122,7 +122,7 @@ public class MockMvcHtmlUnitDriverBuilder extends MockMvcWebConnectionBuilderSup
|
|||
* {@linkplain #build built} by this builder should delegate to when
|
||||
* processing non-{@linkplain WebRequestMatcher matching} requests.
|
||||
* @param driver the {@code WebConnectionHtmlUnitDriver} to delegate to
|
||||
* for requests that do not match; never {@code null}
|
||||
* for requests that do not match (never {@code null})
|
||||
* @return this builder for further customizations
|
||||
* @see #build()
|
||||
*/
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit.webdriver;
|
||||
|
@ -41,13 +41,14 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
|
|||
|
||||
private WebClient webClient;
|
||||
|
||||
public WebConnectionHtmlUnitDriver(BrowserVersion browserVersion) {
|
||||
super(browserVersion);
|
||||
}
|
||||
|
||||
public WebConnectionHtmlUnitDriver() {
|
||||
}
|
||||
|
||||
public WebConnectionHtmlUnitDriver(BrowserVersion browserVersion) {
|
||||
super(browserVersion);
|
||||
}
|
||||
|
||||
public WebConnectionHtmlUnitDriver(boolean enableJavascript) {
|
||||
super(enableJavascript);
|
||||
}
|
||||
|
@ -58,12 +59,10 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
|
|||
|
||||
|
||||
/**
|
||||
* Modify the supplied {@link WebClient} and retain a reference to it
|
||||
* so that its {@link WebConnection} is {@linkplain #getWebConnection
|
||||
* accessible} for later use.
|
||||
* <p>Delegates to {@link HtmlUnitDriver#modifyWebClient(WebClient)}
|
||||
* for default behavior and to {@link #modifyWebClientInternal(WebClient)}
|
||||
* for further customization.
|
||||
* Modify the supplied {@link WebClient} and retain a reference to it so that its
|
||||
* {@link WebConnection} is {@linkplain #getWebConnection accessible} for later use.
|
||||
* <p>Delegates to {@link HtmlUnitDriver#modifyWebClient} for default behavior
|
||||
* and to {@link #modifyWebClientInternal} for further customization.
|
||||
* @param webClient the client to modify
|
||||
* @return the modified client
|
||||
* @see HtmlUnitDriver#modifyWebClient(WebClient)
|
||||
|
@ -78,8 +77,7 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
|
|||
|
||||
/**
|
||||
* Modify the supplied {@link WebClient}.
|
||||
* <p>The default implementation simply returns the supplied client
|
||||
* unmodified.
|
||||
* <p>The default implementation simply returns the supplied client unmodified.
|
||||
* <p>Subclasses can override this method to customize the {@code WebClient}
|
||||
* that the {@link HtmlUnitDriver} uses.
|
||||
* @param webClient the client to modify
|
||||
|
@ -90,16 +88,15 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Access the current {@link WebConnection} for the {@link WebClient}.
|
||||
* @return the current {@code WebConnection}
|
||||
* Return the current {@link WebClient}.
|
||||
*/
|
||||
public WebConnection getWebConnection() {
|
||||
return this.webClient.getWebConnection();
|
||||
public WebClient getWebClient() {
|
||||
return this.webClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link WebConnection} to be used with the {@link WebClient}.
|
||||
* @param webConnection the {@code WebConnection} to use; never {@code null}
|
||||
* @param webConnection the {@code WebConnection} to use (never {@code null})
|
||||
*/
|
||||
public void setWebConnection(WebConnection webConnection) {
|
||||
Assert.notNull(webConnection, "WebConnection must not be null");
|
||||
|
@ -107,10 +104,11 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the current {@link WebClient}
|
||||
* @return the current {@link WebClient}
|
||||
* Access the current {@link WebConnection} for the {@link WebClient}.
|
||||
* @return the current {@code WebConnection}
|
||||
*/
|
||||
public WebClient getWebClient() {
|
||||
return this.webClient;
|
||||
public WebConnection getWebConnection() {
|
||||
return this.webClient.getWebConnection();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.setup;
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.mock.web;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
@ -19,10 +19,17 @@ package org.springframework.test.web.servlet.htmlunit;
|
|||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.HttpWebConnection;
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.WebConnection;
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
import com.gargoylesoftware.htmlunit.WebResponse;
|
||||
import com.gargoylesoftware.htmlunit.WebResponseData;
|
||||
import com.gargoylesoftware.htmlunit.util.NameValuePair;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
|
@ -33,20 +40,11 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.HttpWebConnection;
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.WebConnection;
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
import com.gargoylesoftware.htmlunit.WebResponse;
|
||||
import com.gargoylesoftware.htmlunit.WebResponseData;
|
||||
import com.gargoylesoftware.htmlunit.util.NameValuePair;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.sameInstance;
|
||||
import static org.hamcrest.Matchers.isEmptyString;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.core.IsNot.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
@ -24,7 +24,6 @@ import com.gargoylesoftware.htmlunit.WebClient;
|
|||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
import com.gargoylesoftware.htmlunit.WebResponse;
|
||||
import com.gargoylesoftware.htmlunit.util.Cookie;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -44,9 +43,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link MockMvcWebClientBuilder}.
|
||||
|
|
|
@ -1,34 +1,33 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link MockMvcWebConnection}.
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
import com.gargoylesoftware.htmlunit.WebResponse;
|
||||
import com.gargoylesoftware.htmlunit.util.NameValuePair;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.endsWith;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.startsWith;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests for {@link MockWebResponseBuilder}.
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit.webdriver;
|
||||
|
@ -40,12 +40,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link MockMvcHtmlUnitDriverBuilder}.
|
||||
|
|
|
@ -1,39 +1,36 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.htmlunit.webdriver;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebConnection;
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebConnection;
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link WebConnectionHtmlUnitDriver}.
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.samples.standalone;
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.setup;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.web.servlet.setup;
|
||||
|
||||
import org.junit.Rule;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -28,13 +28,15 @@ import org.springframework.core.Ordered;
|
|||
|
||||
/**
|
||||
* Enables Spring's annotation-driven transaction management capability, similar to
|
||||
* the support found in Spring's {@code <tx:*>} XML namespace. To be used
|
||||
* on @{@link org.springframework.context.annotation.Configuration Configuration} classes
|
||||
* the support found in Spring's {@code <tx:*>} XML namespace. To be used on
|
||||
* @{@link org.springframework.context.annotation.Configuration Configuration} classes
|
||||
* as follows:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableTransactionManagement
|
||||
* public class AppConfig {
|
||||
*
|
||||
* @Bean
|
||||
* public FooRepository fooRepository() {
|
||||
* // configure and return a class having @Transactional methods
|
||||
|
@ -54,19 +56,26 @@ import org.springframework.core.Ordered;
|
|||
*
|
||||
* <p>For reference, the example above can be compared to the following Spring XML
|
||||
* configuration:
|
||||
*
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* <beans>
|
||||
*
|
||||
* <tx:annotation-driven/>
|
||||
*
|
||||
* <bean id="fooRepository" class="com.foo.JdbcFooRepository">
|
||||
* <constructor-arg ref="dataSource"/>
|
||||
* </bean>
|
||||
*
|
||||
* <bean id="dataSource" class="com.vendor.VendorDataSource"/>
|
||||
*
|
||||
* <bean id="transactionManager" class="org.sfwk...DataSourceTransactionManager">
|
||||
* <constructor-arg ref="dataSource"/>
|
||||
* </bean>
|
||||
*
|
||||
* </beans>
|
||||
* }</pre>
|
||||
*
|
||||
* In both of the scenarios above, {@code @EnableTransactionManagement} and {@code
|
||||
* <tx:annotation-driven/>} are responsible for registering the necessary Spring
|
||||
* components that power annotation-driven transaction management, such as the
|
||||
|
@ -87,10 +96,12 @@ import org.springframework.core.Ordered;
|
|||
* {@code @EnableTransactionManagement} and the exact transaction manager bean to be used,
|
||||
* the {@link TransactionManagementConfigurer} callback interface may be implemented -
|
||||
* notice the {@code implements} clause and the {@code @Override}-annotated method below:
|
||||
*
|
||||
* <pre class="code">
|
||||
* @Configuration
|
||||
* @EnableTransactionManagement
|
||||
* public class AppConfig implements TransactionManagementConfigurer {
|
||||
*
|
||||
* @Bean
|
||||
* public FooRepository fooRepository() {
|
||||
* // configure and return a class having @Transactional methods
|
||||
|
@ -112,6 +123,7 @@ import org.springframework.core.Ordered;
|
|||
* return txManager();
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* This approach may be desirable simply because it is more explicit, or it may be
|
||||
* necessary in order to distinguish between two {@code PlatformTransactionManager} beans
|
||||
* present in the same container. As the name suggests, the
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.config.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
@ -43,17 +47,17 @@ import org.springframework.context.annotation.Import;
|
|||
* @ComponentScan(basePackageClasses = { MyConfiguration.class })
|
||||
* public class MyConfiguration extends WebMvcConfigurerAdapter {
|
||||
*
|
||||
* @Override
|
||||
* public void addFormatters(FormatterRegistry formatterRegistry) {
|
||||
* formatterRegistry.addConverter(new MyConverter());
|
||||
* }
|
||||
* @Override
|
||||
* public void addFormatters(FormatterRegistry formatterRegistry) {
|
||||
* formatterRegistry.addConverter(new MyConverter());
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
* public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
* converters.add(new MyHttpMessageConverter());
|
||||
* }
|
||||
* @Override
|
||||
* public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
* converters.add(new MyHttpMessageConverter());
|
||||
* }
|
||||
*
|
||||
* // More overridden methods ...
|
||||
* // More overridden methods ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
|
@ -67,16 +71,16 @@ import org.springframework.context.annotation.Import;
|
|||
* @ComponentScan(basePackageClasses = { MyConfiguration.class })
|
||||
* public class MyConfiguration extends WebMvcConfigurationSupport {
|
||||
*
|
||||
* @Override
|
||||
* public void addFormatters(FormatterRegistry formatterRegistry) {
|
||||
* formatterRegistry.addConverter(new MyConverter());
|
||||
* }
|
||||
* @Override
|
||||
* public void addFormatters(FormatterRegistry formatterRegistry) {
|
||||
* formatterRegistry.addConverter(new MyConverter());
|
||||
* }
|
||||
*
|
||||
* @Bean
|
||||
* public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
|
||||
* // Create or delegate to "super" to create and
|
||||
* // customize properties of RequestMappingHandlerAdapter
|
||||
* }
|
||||
* @Bean
|
||||
* public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
|
||||
* // Create or delegate to "super" to create and
|
||||
* // customize properties of RequestMappingHandlerAdapter
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.socket.config.annotation;
|
||||
|
@ -32,6 +35,7 @@ import org.springframework.context.annotation.Import;
|
|||
*
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>Customize the imported configuration by implementing the
|
||||
* {@link WebSocketConfigurer} interface:
|
||||
*
|
||||
|
@ -40,15 +44,15 @@ import org.springframework.context.annotation.Import;
|
|||
* @EnableWebSocket
|
||||
* public class MyConfiguration implements WebSocketConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
* registry.addHandler(echoWebSocketHandler(), "/echo").withSockJS();
|
||||
* }
|
||||
* @Override
|
||||
* public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
* registry.addHandler(echoWebSocketHandler(), "/echo").withSockJS();
|
||||
* }
|
||||
*
|
||||
* @Bean
|
||||
* public WebSocketHandler echoWebSocketHandler() {
|
||||
* return new EchoWebSocketHandler();
|
||||
* }
|
||||
* @Bean
|
||||
* public WebSocketHandler echoWebSocketHandler() {
|
||||
* return new EchoWebSocketHandler();
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.socket.config.annotation;
|
||||
|
@ -32,8 +35,8 @@ import org.springframework.context.annotation.Import;
|
|||
*
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* Customize the imported configuration by implementing the
|
||||
*
|
||||
* <p>Customize the imported configuration by implementing the
|
||||
* {@link WebSocketMessageBrokerConfigurer} interface or more likely extend the
|
||||
* convenient base class {@link AbstractWebSocketMessageBrokerConfigurer}:
|
||||
*
|
||||
|
@ -42,16 +45,16 @@ import org.springframework.context.annotation.Import;
|
|||
* @EnableWebSocketMessageBroker
|
||||
* public class MyConfiguration extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
*
|
||||
* @Override
|
||||
* public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
* registry.addEndpoint("/portfolio").withSockJS();
|
||||
* }
|
||||
* @Override
|
||||
* public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
* registry.addEndpoint("/portfolio").withSockJS();
|
||||
* }
|
||||
*
|
||||
* @Bean
|
||||
* public void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||
* registry.enableStompBrokerRelay("/queue/", "/topic/");
|
||||
* registry.setApplicationDestinationPrefixes("/app/");
|
||||
* }
|
||||
* @Bean
|
||||
* public void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||
* registry.enableStompBrokerRelay("/queue/", "/topic/");
|
||||
* registry.setApplicationDestinationPrefixes("/app/");
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue