Browse Source

Ensure PDF version of Reference Manual does not contain HTML <strong> tags

Prior to this commit, the PDF version of the Spring Reference Manual
contained HTML <strong></strong> tags in code examples due to the fact
that Asciidoctor converts bold formatting (i.e., elements wrapped in
`**` or `*`) within source code blocks into HTML tags even for PDF
rendering.

This commit addresses this issue by removing all bold formatting from
example code blocks.

Closes gh-22577
pull/22634/head
Sam Brannen 7 years ago
parent
commit
8f7b118701
  1. 6
      src/docs/asciidoc/core/core-aop.adoc
  2. 2
      src/docs/asciidoc/core/core-appendix.adoc
  3. 52
      src/docs/asciidoc/core/core-beans.adoc
  4. 2
      src/docs/asciidoc/core/core-validation.adoc
  5. 12
      src/docs/asciidoc/data-access.adoc
  6. 8
      src/docs/asciidoc/integration-appendix.adoc
  7. 30
      src/docs/asciidoc/integration.adoc
  8. 4
      src/docs/asciidoc/languages/dynamic-languages.adoc
  9. 24
      src/docs/asciidoc/testing.adoc
  10. 2
      src/docs/asciidoc/web/webflux-webclient.adoc
  11. 6
      src/docs/asciidoc/web/webflux.adoc
  12. 10
      src/docs/asciidoc/web/webmvc.adoc
  13. 6
      src/docs/asciidoc/web/websocket.adoc

6
src/docs/asciidoc/core/core-aop.adoc

@ -1808,14 +1808,14 @@ respectively. For example, the previous pointcut can be better written as follow
==== ====
[source,xml,indent=0] [source,xml,indent=0]
[subs="verbatim,quotes"] [subs="verbatim"]
---- ----
<aop:config> <aop:config>
<aop:aspect id="myAspect" ref="aBean"> <aop:aspect id="myAspect" ref="aBean">
<aop:pointcut id="businessService" <aop:pointcut id="businessService"
expression="execution(* com.xyz.myapp.service.*.*(..)) **and** this(service)"/> expression="execution(* com.xyz.myapp.service.*.*(..)) and this(service)"/>
<aop:before pointcut-ref="businessService" method="monitor"/> <aop:before pointcut-ref="businessService" method="monitor"/>
@ -3331,7 +3331,7 @@ the following example:
class="foo.StubEntitlementCalculationService"/> class="foo.StubEntitlementCalculationService"/>
<!-- this switches on the load-time weaving --> <!-- this switches on the load-time weaving -->
**<context:load-time-weaver/>** <context:load-time-weaver/>
</beans> </beans>
---- ----
==== ====

2
src/docs/asciidoc/core/core-appendix.adoc

@ -875,7 +875,7 @@ use the `NamespaceHandlerSupport` class:
public class MyNamespaceHandler extends NamespaceHandlerSupport { public class MyNamespaceHandler extends NamespaceHandlerSupport {
public void init() { public void init() {
**registerBeanDefinitionParser("dateformat", new SimpleDateFormatBeanDefinitionParser());** registerBeanDefinitionParser("dateformat", new SimpleDateFormatBeanDefinitionParser());
} }
} }

52
src/docs/asciidoc/core/core-beans.adoc

@ -2806,7 +2806,7 @@ to do so:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
**@RequestScope** @RequestScope
@Component @Component
public class LoginAction { public class LoginAction {
// ... // ...
@ -2846,7 +2846,7 @@ When using annotation-driven components or Java configuration, you can use the
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
**@SessionScope** @SessionScope
@Component @Component
public class UserPreferences { public class UserPreferences {
// ... // ...
@ -2885,7 +2885,7 @@ following example shows how to do so:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
**@ApplicationScope** @ApplicationScope
@Component @Component
public class AppPreferences { public class AppPreferences {
// ... // ...
@ -4893,7 +4893,7 @@ primary `MovieCatalog`:
public class MovieConfiguration { public class MovieConfiguration {
@Bean @Bean
**@Primary** @Primary
public MovieCatalog firstMovieCatalog() { ... } public MovieCatalog firstMovieCatalog() { ... }
@Bean @Bean
@ -4938,7 +4938,7 @@ The corresponding bean definitions follow:
<context:annotation-config/> <context:annotation-config/>
<bean class="example.SimpleMovieCatalog" **primary="true"**> <bean class="example.SimpleMovieCatalog" primary="true">
<!-- inject any dependencies required by this bean --> <!-- inject any dependencies required by this bean -->
</bean> </bean>
@ -4971,7 +4971,7 @@ shown in the following example:
public class MovieRecommender { public class MovieRecommender {
@Autowired @Autowired
**@Qualifier("main")** @Qualifier("main")
private MovieCatalog movieCatalog; private MovieCatalog movieCatalog;
// ... // ...
@ -4993,7 +4993,7 @@ method parameters, as shown in the following example:
private CustomerPreferenceDao customerPreferenceDao; private CustomerPreferenceDao customerPreferenceDao;
@Autowired @Autowired
public void prepare(**@Qualifier("main")**MovieCatalog movieCatalog, public void prepare(@Qualifier("main") MovieCatalog movieCatalog,
CustomerPreferenceDao customerPreferenceDao) { CustomerPreferenceDao customerPreferenceDao) {
this.movieCatalog = movieCatalog; this.movieCatalog = movieCatalog;
this.customerPreferenceDao = customerPreferenceDao; this.customerPreferenceDao = customerPreferenceDao;
@ -5113,7 +5113,7 @@ provide the `@Qualifier` annotation within your definition, as the following exa
---- ----
@Target({ElementType.FIELD, ElementType.PARAMETER}) @Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
**@Qualifier** @Qualifier
public @interface Genre { public @interface Genre {
String value(); String value();
@ -5131,13 +5131,13 @@ following example shows:
public class MovieRecommender { public class MovieRecommender {
@Autowired @Autowired
**@Genre("Action")** @Genre("Action")
private MovieCatalog actionCatalog; private MovieCatalog actionCatalog;
private MovieCatalog comedyCatalog; private MovieCatalog comedyCatalog;
@Autowired @Autowired
public void setComedyCatalog(**@Genre("Comedy")** MovieCatalog comedyCatalog) { public void setComedyCatalog(@Genre("Comedy") MovieCatalog comedyCatalog) {
this.comedyCatalog = comedyCatalog; this.comedyCatalog = comedyCatalog;
} }
@ -5169,12 +5169,12 @@ demonstrates both approaches:
<context:annotation-config/> <context:annotation-config/>
<bean class="example.SimpleMovieCatalog"> <bean class="example.SimpleMovieCatalog">
**<qualifier type="Genre" value="Action"/>** <qualifier type="Genre" value="Action"/>
<!-- inject any dependencies required by this bean --> <!-- inject any dependencies required by this bean -->
</bean> </bean>
<bean class="example.SimpleMovieCatalog"> <bean class="example.SimpleMovieCatalog">
**<qualifier type="example.Genre" value="Comedy"/>** <qualifier type="example.Genre" value="Comedy"/>
<!-- inject any dependencies required by this bean --> <!-- inject any dependencies required by this bean -->
</bean> </bean>
@ -5496,7 +5496,7 @@ named `movieFinder` injected into its setter method:
private MovieFinder movieFinder; private MovieFinder movieFinder;
**@Resource** @Resource
public void setMovieFinder(MovieFinder movieFinder) { public void setMovieFinder(MovieFinder movieFinder) {
this.movieFinder = movieFinder; this.movieFinder = movieFinder;
} }
@ -5705,7 +5705,7 @@ You can then use `@SessionScope` without declaring the `proxyMode` as follows:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Service @Service
**@SessionScope** @SessionScope
public class SessionScopedService { public class SessionScopedService {
// ... // ...
} }
@ -5719,7 +5719,7 @@ You can also override the value for the `proxyMode`, as the following example sh
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Service @Service
**@SessionScope(proxyMode = ScopedProxyMode.INTERFACES)** @SessionScope(proxyMode = ScopedProxyMode.INTERFACES)
public class SessionScopedUserService implements UserService { public class SessionScopedUserService implements UserService {
// ... // ...
} }
@ -6248,7 +6248,7 @@ technique:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Component @Component
**@Qualifier("Action")** @Qualifier("Action")
public class ActionMovieCatalog implements MovieCatalog { public class ActionMovieCatalog implements MovieCatalog {
// ... // ...
} }
@ -6258,7 +6258,7 @@ technique:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Component @Component
**@Genre("Action")** @Genre("Action")
public class ActionMovieCatalog implements MovieCatalog { public class ActionMovieCatalog implements MovieCatalog {
// ... // ...
} }
@ -6268,7 +6268,7 @@ technique:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Component @Component
**@Offline** @Offline
public class CachingMovieCatalog implements MovieCatalog { public class CachingMovieCatalog implements MovieCatalog {
// ... // ...
} }
@ -7189,7 +7189,7 @@ as the following example shows:
public class MyConfiguration { public class MyConfiguration {
@Bean @Bean
**@Scope("prototype")** @Scope("prototype")
public Encryptor encryptor() { public Encryptor encryptor() {
// ... // ...
} }
@ -7217,7 +7217,7 @@ it resembles the following:
---- ----
// an HTTP Session-scoped bean exposed as a proxy // an HTTP Session-scoped bean exposed as a proxy
@Bean @Bean
**@SessionScope** @SessionScope
public UserPreferences userPreferences() { public UserPreferences userPreferences() {
return new UserPreferences(); return new UserPreferences();
} }
@ -7298,7 +7298,7 @@ annotation, as the following example shows:
public class AppConfig { public class AppConfig {
@Bean @Bean
**@Description("Provides a basic example of a bean")** @Description("Provides a basic example of a bean")
public Thing thing() { public Thing thing() {
return new Thing(); return new Thing();
} }
@ -8127,7 +8127,7 @@ can rewrite the `dataSource` configuration as follows:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Configuration @Configuration
**@Profile("development")** @Profile("development")
public class StandaloneDataConfig { public class StandaloneDataConfig {
@Bean @Bean
@ -8145,7 +8145,7 @@ can rewrite the `dataSource` configuration as follows:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Configuration @Configuration
**@Profile("production")** @Profile("production")
public class JndiDataConfig { public class JndiDataConfig {
@Bean(destroyMethod="") @Bean(destroyMethod="")
@ -8186,7 +8186,7 @@ of creating a custom composed annotation. The following example defines a custom
---- ----
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
**@Profile("production")** @Profile("production")
public @interface Production { public @interface Production {
} }
---- ----
@ -8423,7 +8423,7 @@ following example:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Configuration @Configuration
**@Profile("default")** @Profile("default")
public class DefaultDataConfig { public class DefaultDataConfig {
@Bean @Bean
@ -8540,7 +8540,7 @@ a call to `testBean.getName()` returns `myTestBean`:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Configuration @Configuration
**@PropertySource("classpath:/com/myco/app.properties")** @PropertySource("classpath:/com/myco/app.properties")
public class AppConfig { public class AppConfig {
@Autowired @Autowired

2
src/docs/asciidoc/core/core-validation.adoc

@ -707,7 +707,7 @@ implementation of an `initBinder(..)` method:
protected void initBinder(HttpServletRequest request, protected void initBinder(HttpServletRequest request,
ServletRequestDataBinder binder) throws Exception { ServletRequestDataBinder binder) throws Exception {
**this.customPropertyEditorRegistrar.registerCustomEditors(binder);** this.customPropertyEditorRegistrar.registerCustomEditors(binder);
} }
// other methods to do with registering a User // other methods to do with registering a User

12
src/docs/asciidoc/data-access.adoc

@ -1078,7 +1078,7 @@ Consider the following class definition:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
// the service class that we want to make transactional // the service class that we want to make transactional
**@Transactional** @Transactional
public class DefaultFooService implements FooService { public class DefaultFooService implements FooService {
Foo getFoo(String fooName); Foo getFoo(String fooName);
@ -1553,7 +1553,7 @@ The following code shows the simple profiling aspect discussed earlier:
this.order = order; this.order = order;
} }
// this method *is* the around advice // this method is the around advice
public Object profile(ProceedingJoinPoint call) throws Throwable { public Object profile(ProceedingJoinPoint call) throws Throwable {
Object returnValue; Object returnValue;
StopWatch clock = new StopWatch(getClass().getName()); StopWatch clock = new StopWatch(getClass().getName());
@ -1817,7 +1817,7 @@ with an anonymous class, as follows:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
transactionTemplate.execute(new **TransactionCallbackWithoutResult**() { transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) { protected void doInTransactionWithoutResult(TransactionStatus status) {
updateOperation1(); updateOperation1();
updateOperation2(); updateOperation2();
@ -1840,7 +1840,7 @@ Code within the callback can roll the transaction back by calling the
updateOperation1(); updateOperation1();
updateOperation2(); updateOperation2();
} catch (SomeBusinessException ex) { } catch (SomeBusinessException ex) {
**status.setRollbackOnly();** status.setRollbackOnly();
} }
} }
}); });
@ -2606,7 +2606,7 @@ the setter for the `DataSource`. This leads to DAOs that resemble the following:
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource) { public void setDataSource(DataSource dataSource) {
**this.jdbcTemplate = new JdbcTemplate(dataSource);** this.jdbcTemplate = new JdbcTemplate(dataSource);
} }
// JDBC-backed implementations of the methods on the CorporateEventDao follow... // JDBC-backed implementations of the methods on the CorporateEventDao follow...
@ -5044,7 +5044,7 @@ errors in the SQL it executes from the scripts, as the following example shows:
[source,xml,indent=0] [source,xml,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
<jdbc:initialize-database data-source="dataSource" **ignore-failures="DROPS"**> <jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
<jdbc:script location="..."/> <jdbc:script location="..."/>
</jdbc:initialize-database> </jdbc:initialize-database>
---- ----

8
src/docs/asciidoc/integration-appendix.adoc

@ -47,12 +47,12 @@ The following example shows how to use JNDI to look up a data source without the
[source,xml,indent=0] [source,xml,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
<bean id="**dataSource**" class="org.springframework.jndi.JndiObjectFactoryBean"> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/MyDataSource"/> <property name="jndiName" value="jdbc/MyDataSource"/>
</bean> </bean>
<bean id="userDao" class="com.foo.JdbcUserDao"> <bean id="userDao" class="com.foo.JdbcUserDao">
<!-- Spring will do the cast automatically (as usual) --> <!-- Spring will do the cast automatically (as usual) -->
<property name="dataSource" ref="**dataSource**"/> <property name="dataSource" ref="dataSource"/>
</bean> </bean>
---- ----
==== ====
@ -64,11 +64,11 @@ schema:
[source,xml,indent=0] [source,xml,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
<jee:jndi-lookup id="**dataSource**" jndi-name="jdbc/MyDataSource"/> <jee:jndi-lookup id="dataSource" jndi-name="jdbc/MyDataSource"/>
<bean id="userDao" class="com.foo.JdbcUserDao"> <bean id="userDao" class="com.foo.JdbcUserDao">
<!-- Spring will do the cast automatically (as usual) --> <!-- Spring will do the cast automatically (as usual) -->
<property name="dataSource" ref="**dataSource**"/> <property name="dataSource" ref="dataSource"/>
</bean> </bean>
---- ----
==== ====

30
src/docs/asciidoc/integration.adoc

@ -2119,7 +2119,7 @@ containers that ships with Spring (in this case, `DefaultMessageListenerContaine
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/> <property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/> <property name="destination" ref="destination"/>
**<property name="messageListener" ref="messageListener"/>** <property name="messageListener" ref="messageListener"/>
</bean> </bean>
---- ----
==== ====
@ -2219,17 +2219,17 @@ POJO that we can make into an MDP through the following configuration:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
<!-- this is the Message Driven POJO (MDP) --> <!-- this is the Message Driven POJO (MDP) -->
**<bean id="messageListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter"> <bean id="messageListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
<constructor-arg> <constructor-arg>
<bean class="jmsexample.DefaultMessageDelegate"/> <bean class="jmsexample.DefaultMessageDelegate"/>
</constructor-arg> </constructor-arg>
</bean>** </bean>
<!-- and this is the message listener container... --> <!-- and this is the message listener container... -->
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/> <property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/> <property name="destination" ref="destination"/>
**<property name="messageListener" ref="messageListener"/>** <property name="messageListener" ref="messageListener"/>
</bean> </bean>
---- ----
==== ====
@ -2346,7 +2346,7 @@ Consider the following bean definition:
<property name="connectionFactory" ref="connectionFactory"/> <property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/> <property name="destination" ref="destination"/>
<property name="messageListener" ref="messageListener"/> <property name="messageListener" ref="messageListener"/>
**<property name="sessionTransacted" value="true"/>** <property name="sessionTransacted" value="true"/>
</bean> </bean>
---- ----
==== ====
@ -2818,7 +2818,7 @@ namespace elements, you need to reference the JMS schema, as the following examp
xmlns:jms="http://www.springframework.org/schema/jms" <1> xmlns:jms="http://www.springframework.org/schema/jms" <1>
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
**http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd**"> http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd">
<!-- bean definitions here --> <!-- bean definitions here -->
@ -7323,13 +7323,13 @@ do yourself a favor and read <<core.adoc#expressions, Spring Expression Language
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Cacheable(cacheNames="books", **key="#isbn"**) @Cacheable(cacheNames="books", key="#isbn")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
@Cacheable(cacheNames="books", **key="#isbn.rawNumber"**) @Cacheable(cacheNames="books", key="#isbn.rawNumber")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
@Cacheable(cacheNames="books", **key="T(someType).hash(#isbn)"**) @Cacheable(cacheNames="books", key="T(someType).hash(#isbn)")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
---- ----
==== ====
@ -7345,7 +7345,7 @@ so, specify the name of the `KeyGenerator` bean implementation to use, as the fo
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Cacheable(cacheNames="books", **keyGenerator="myKeyGenerator"**) @Cacheable(cacheNames="books", keyGenerator="myKeyGenerator")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
---- ----
==== ====
@ -7481,7 +7481,7 @@ supported wrapper, so the previous example can be rewritten as follows:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result?.hardback"**) @Cacheable(cacheNames="book", condition="#name.length() < 32", unless="#result?.hardback")
public Optional<Book> findBook(String name) public Optional<Book> findBook(String name)
---- ----
==== ====
@ -7977,11 +7977,11 @@ Spring's abstraction and the other using JCache:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@Cacheable(cacheNames="books", **key="#isbn"**) @Cacheable(cacheNames="books", key="#isbn")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
@CacheResult(cacheName="books") @CacheResult(cacheName="books")
public Book findBook(**@CacheKey** ISBN isbn, boolean checkWarehouse, boolean includeUsed) public Book findBook(@CacheKey ISBN isbn, boolean checkWarehouse, boolean includeUsed)
---- ----
==== ====
@ -8000,8 +8000,8 @@ invoking the method again:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@CacheResult(cacheName="books", **exceptionCacheName="failures"** @CacheResult(cacheName="books", exceptionCacheName="failures"
**cachedExceptions = InvalidIsbnNotFoundException.class**) cachedExceptions = InvalidIsbnNotFoundException.class)
public Book findBook(ISBN isbn) public Book findBook(ISBN isbn)
---- ----
==== ====

4
src/docs/asciidoc/languages/dynamic-languages.adoc

@ -417,9 +417,9 @@ does not work:
---- ----
<lang:groovy id="badMessenger" <lang:groovy id="badMessenger"
script-source="classpath:Messenger.groovy"> script-source="classpath:Messenger.groovy">
<!-- this next constructor argument will *not* be injected into the GroovyMessenger --> <!-- this next constructor argument will not be injected into the GroovyMessenger -->
<!-- in fact, this isn't even allowed according to the schema --> <!-- in fact, this isn't even allowed according to the schema -->
<constructor-arg value="This will *not* work" /> <constructor-arg value="This will not work" />
<!-- only property values are injected into the dynamic-language-backed object --> <!-- only property values are injected into the dynamic-language-backed object -->
<lang:property name="anotherMessage" value="Passed straight through to the dynamic-language-backed object" /> <lang:property name="anotherMessage" value="Passed straight through to the dynamic-language-backed object" />

24
src/docs/asciidoc/testing.adoc

@ -3346,11 +3346,11 @@ The first code listing shows a JUnit 4 based implementation of the test class th
---- ----
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
// specifies the Spring configuration to load for this test fixture // specifies the Spring configuration to load for this test fixture
**@ContextConfiguration("repository-config.xml")** @ContextConfiguration("repository-config.xml")
public class HibernateTitleRepositoryTests { public class HibernateTitleRepositoryTests {
// this instance will be dependency injected by type // this instance will be dependency injected by type
**@Autowired** @Autowired
private HibernateTitleRepository titleRepository; private HibernateTitleRepository titleRepository;
@Test @Test
@ -3371,13 +3371,13 @@ follows:
---- ----
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
// specifies the Spring configuration to load for this test fixture // specifies the Spring configuration to load for this test fixture
**@ContextConfiguration("repository-config.xml")** @ContextConfiguration("repository-config.xml")
public class HibernateTitleRepositoryTests { public class HibernateTitleRepositoryTests {
// this instance will be dependency injected by type // this instance will be dependency injected by type
private HibernateTitleRepository titleRepository; private HibernateTitleRepository titleRepository;
**@Autowired** @Autowired
public void setTitleRepository(HibernateTitleRepository titleRepository) { public void setTitleRepository(HibernateTitleRepository titleRepository) {
this.titleRepository = titleRepository; this.titleRepository = titleRepository;
} }
@ -3406,7 +3406,7 @@ shows this configuration:
http://www.springframework.org/schema/beans/spring-beans.xsd"> http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- this bean will be injected into the HibernateTitleRepositoryTests class --> <!-- this bean will be injected into the HibernateTitleRepositoryTests class -->
<bean id="**titleRepository**" class="**com.foo.repository.hibernate.HibernateTitleRepository**"> <bean id="titleRepository" class="com.foo.repository.hibernate.HibernateTitleRepository">
<property name="sessionFactory" ref="sessionFactory"/> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
@ -3435,8 +3435,8 @@ method in the superclass as well):
@Autowired @Autowired
@Override @Override
public void setDataSource(**@Qualifier("myDataSource")** DataSource dataSource) { public void setDataSource(@Qualifier("myDataSource") DataSource dataSource) {
**super**.setDataSource(dataSource); super.setDataSource(dataSource);
} }
// ... // ...
@ -3809,11 +3809,11 @@ following example shows the relevant annotations in bold:
---- ----
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration @ContextConfiguration
**@Transactional(transactionManager = "txMgr")** @Transactional(transactionManager = "txMgr")
**@Commit** @Commit
public class FictitiousTransactionalTest { public class FictitiousTransactionalTest {
**@BeforeTransaction** @BeforeTransaction
void verifyInitialDatabaseState() { void verifyInitialDatabaseState() {
// logic to verify the initial state before a transaction is started // logic to verify the initial state before a transaction is started
} }
@ -3825,7 +3825,7 @@ following example shows the relevant annotations in bold:
@Test @Test
// overrides the class-level @Commit setting // overrides the class-level @Commit setting
**@Rollback** @Rollback
public void modifyDatabaseWithinTransaction() { public void modifyDatabaseWithinTransaction() {
// logic which uses the test data and modifies database state // logic which uses the test data and modifies database state
} }
@ -3835,7 +3835,7 @@ following example shows the relevant annotations in bold:
// execute "tear down" logic within the transaction // execute "tear down" logic within the transaction
} }
**@AfterTransaction** @AfterTransaction
void verifyFinalDatabaseState() { void verifyFinalDatabaseState() {
// logic to verify the final state after transaction has rolled back // logic to verify the final state after transaction has rolled back
} }

2
src/docs/asciidoc/web/webflux-webclient.adoc

@ -475,7 +475,7 @@ through the `syncBody` method, as the following example shows:
Mono<Void> result = client.post() Mono<Void> result = client.post()
.uri("/path", id) .uri("/path", id)
.syncBody(**builder.build()**) .syncBody(builder.build())
.retrieve() .retrieve()
.bodyToMono(Void.class); .bodyToMono(Void.class);
---- ----

6
src/docs/asciidoc/web/webflux.adoc

@ -1339,7 +1339,7 @@ as the following example shows:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping(path = "/pets", **consumes = "application/json"**) @PostMapping(path = "/pets", consumes = "application/json")
public void addPet(@RequestBody Pet pet) { public void addPet(@RequestBody Pet pet) {
// ... // ...
} }
@ -1368,7 +1368,7 @@ content types that a controller method produces, as the following example shows:
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@GetMapping(path = "/pets/{petId}", **produces = "application/json;charset=UTF-8"**) @GetMapping(path = "/pets/{petId}", produces = "application/json;charset=UTF-8")
@ResponseBody @ResponseBody
public Pet getPet(@PathVariable String petId) { public Pet getPet(@PathVariable String petId) {
// ... // ...
@ -2023,7 +2023,7 @@ You can automatically apply validation after data binding by adding the
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping("/owners/{ownerId}/pets/{petId}/edit") @PostMapping("/owners/{ownerId}/pets/{petId}/edit")
public String processSubmit(**@Valid @ModelAttribute("pet") Pet pet**, BindingResult result) { <1> public String processSubmit(@Valid @ModelAttribute("pet") Pet pet, BindingResult result) { <1>
if (result.hasErrors()) { if (result.hasErrors()) {
return "petForm"; return "petForm";
} }

10
src/docs/asciidoc/web/webmvc.adoc

@ -2078,7 +2078,7 @@ The following example shows how to do so:
// ... // ...
@GetMapping @GetMapping
public String setupForm(**@RequestParam("petId") int petId**, Model model) { <1> public String setupForm(@RequestParam("petId") int petId, Model model) { <1>
Pet pet = this.clinic.loadPet(petId); Pet pet = this.clinic.loadPet(petId);
model.addAttribute("pet", pet); model.addAttribute("pet", pet);
return "petForm"; return "petForm";
@ -2633,8 +2633,8 @@ probably want it deserialized from JSON (similar to `@RequestBody`). Use the
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping("/") @PostMapping("/")
public String handle(**@RequestPart("meta-data") MetaData metadata, public String handle(@RequestPart("meta-data") MetaData metadata,
@RequestPart("file-data") MultipartFile file**) { @RequestPart("file-data") MultipartFile file) {
// ... // ...
} }
---- ----
@ -2652,8 +2652,8 @@ as the following example shows:
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping("/") @PostMapping("/")
public String handle(**@Valid** @RequestPart("meta-data") MetaData metadata, public String handle(@Valid @RequestPart("meta-data") MetaData metadata,
**BindingResult result**) { BindingResult result) {
// ... // ...
} }
---- ----

6
src/docs/asciidoc/web/websocket.adoc

@ -1743,7 +1743,7 @@ The following example shows how to do so in Java configuration:
@Override @Override
public void configureMessageBroker(MessageBrokerRegistry registry) { public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setPathMatcher(**new AntPathMatcher("."));** registry.setPathMatcher(new AntPathMatcher("."));
registry.enableStompBrokerRelay("/queue", "/topic"); registry.enableStompBrokerRelay("/queue", "/topic");
registry.setApplicationDestinationPrefixes("/app"); registry.setApplicationDestinationPrefixes("/app");
} }
@ -1766,16 +1766,14 @@ The following example shows the XML configuration equivalent of the preceding ex
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket
http://www.springframework.org/schema/websocket/spring-websocket.xsd"> http://www.springframework.org/schema/websocket/spring-websocket.xsd">
<websocket:message-broker application-destination-prefix="/app" path-matcher="**pathMatcher**"> <websocket:message-broker application-destination-prefix="/app" path-matcher="pathMatcher">
<websocket:stomp-endpoint path="/stomp"/> <websocket:stomp-endpoint path="/stomp"/>
<websocket:stomp-broker-relay prefix="/topic,/queue" /> <websocket:stomp-broker-relay prefix="/topic,/queue" />
</websocket:message-broker> </websocket:message-broker>
**
<bean id="pathMatcher" class="org.springframework.util.AntPathMatcher"> <bean id="pathMatcher" class="org.springframework.util.AntPathMatcher">
<constructor-arg index="0" value="."/> <constructor-arg index="0" value="."/>
</bean> </bean>
**
</beans> </beans>
---- ----

Loading…
Cancel
Save