Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f0f5f78e
Commit
f0f5f78e
authored
Jul 15, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
68d875bd
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
69 additions
and
58 deletions
+69
-58
MessageSourceAutoConfiguration.java
...rk/boot/autoconfigure/MessageSourceAutoConfiguration.java
+3
-1
JndiSessionConfiguration.java
...ork/boot/autoconfigure/mail/JndiSessionConfiguration.java
+0
-1
MailSenderAutoConfiguration.java
.../boot/autoconfigure/mail/MailSenderAutoConfiguration.java
+6
-4
AbstractTemplateViewResolverProperties.java
...gure/template/AbstractTemplateViewResolverProperties.java
+3
-1
AbstractViewResolverProperties.java
...utoconfigure/template/AbstractViewResolverProperties.java
+7
-11
ThymeleafAutoConfiguration.java
...t/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
+7
-5
ThymeleafProperties.java
...ork/boot/autoconfigure/thymeleaf/ThymeleafProperties.java
+1
-1
ViewResolverPropertiesTest.java
...ot/autoconfigure/template/ViewResolverPropertiesTest.java
+5
-5
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+2
-1
MavenSettings.java
.../org/springframework/boot/cli/compiler/MavenSettings.java
+5
-3
MavenSettingsReader.java
...pringframework/boot/cli/compiler/MavenSettingsReader.java
+5
-4
RepositoryConfigurationFactory.java
...ork/boot/cli/compiler/RepositoryConfigurationFactory.java
+0
-1
settings.xml
...ven-settings/active-profile-repositories/.m2/settings.xml
+2
-2
spring-boot-cli.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc
+2
-0
DescriptionExtractor.java
...work/boot/configurationmetadata/DescriptionExtractor.java
+1
-1
DescriptionExtractorTests.java
...boot/configurationmetadata/DescriptionExtractorTests.java
+16
-15
ExpressionTree.java
...figurationprocessor/fieldvalues/javac/ExpressionTree.java
+4
-2
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java
View file @
f0f5f78e
...
@@ -84,7 +84,9 @@ public class MessageSourceAutoConfiguration {
...
@@ -84,7 +84,9 @@ public class MessageSourceAutoConfiguration {
messageSource
messageSource
.
setBasenames
(
commaDelimitedListToStringArray
(
trimAllWhitespace
(
this
.
basename
)));
.
setBasenames
(
commaDelimitedListToStringArray
(
trimAllWhitespace
(
this
.
basename
)));
}
}
messageSource
.
setDefaultEncoding
(
this
.
encoding
.
name
());
if
(
this
.
encoding
!=
null
)
{
messageSource
.
setDefaultEncoding
(
this
.
encoding
.
name
());
}
messageSource
.
setCacheSeconds
(
this
.
cacheSeconds
);
messageSource
.
setCacheSeconds
(
this
.
cacheSeconds
);
return
messageSource
;
return
messageSource
;
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/JndiSessionConfiguration.java
View file @
f0f5f78e
...
@@ -33,7 +33,6 @@ import org.springframework.jndi.JndiLocatorDelegate;
...
@@ -33,7 +33,6 @@ import org.springframework.jndi.JndiLocatorDelegate;
*
*
* @author Eddú Meléndez
* @author Eddú Meléndez
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.3.0
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
(
Session
.
class
)
@ConditionalOnClass
(
Session
.
class
)
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java
View file @
f0f5f78e
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.mail;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.mail;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.activation.MimeType
;
import
javax.activation.MimeType
;
import
javax.mail.Session
;
import
javax.mail.Session
;
import
javax.mail.internet.MimeMessage
;
import
javax.mail.internet.MimeMessage
;
...
@@ -78,7 +79,9 @@ public class MailSenderAutoConfiguration {
...
@@ -78,7 +79,9 @@ public class MailSenderAutoConfiguration {
}
}
sender
.
setUsername
(
this
.
properties
.
getUsername
());
sender
.
setUsername
(
this
.
properties
.
getUsername
());
sender
.
setPassword
(
this
.
properties
.
getPassword
());
sender
.
setPassword
(
this
.
properties
.
getPassword
());
sender
.
setDefaultEncoding
(
this
.
properties
.
getDefaultEncoding
().
name
());
if
(
this
.
properties
.
getDefaultEncoding
()
!=
null
)
{
sender
.
setDefaultEncoding
(
this
.
properties
.
getDefaultEncoding
().
name
());
}
if
(!
this
.
properties
.
getProperties
().
isEmpty
())
{
if
(!
this
.
properties
.
getProperties
().
isEmpty
())
{
sender
.
setJavaMailProperties
(
asProperties
(
this
.
properties
.
getProperties
()));
sender
.
setJavaMailProperties
(
asProperties
(
this
.
properties
.
getProperties
()));
}
}
...
@@ -90,10 +93,9 @@ public class MailSenderAutoConfiguration {
...
@@ -90,10 +93,9 @@ public class MailSenderAutoConfiguration {
return
properties
;
return
properties
;
}
}
/**
/**
* Condition to trigger the creation of a {@link JavaMailSenderImpl}. This kicks
* Condition to trigger the creation of a {@link JavaMailSenderImpl}. This kicks
in if
*
in if
either the host or jndi name property is set.
* either the host or jndi name property is set.
*/
*/
static
class
MailSenderCondition
extends
AnyNestedCondition
{
static
class
MailSenderCondition
extends
AnyNestedCondition
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java
View file @
f0f5f78e
...
@@ -146,7 +146,9 @@ public abstract class AbstractTemplateViewResolverProperties extends
...
@@ -146,7 +146,9 @@ public abstract class AbstractTemplateViewResolverProperties extends
resolver
.
setPrefix
(
getPrefix
());
resolver
.
setPrefix
(
getPrefix
());
resolver
.
setSuffix
(
getSuffix
());
resolver
.
setSuffix
(
getSuffix
());
resolver
.
setCache
(
isCache
());
resolver
.
setCache
(
isCache
());
resolver
.
setContentType
(
getContentType
().
toString
());
if
(
getContentType
()
!=
null
)
{
resolver
.
setContentType
(
getContentType
().
toString
());
}
resolver
.
setViewNames
(
getViewNames
());
resolver
.
setViewNames
(
getViewNames
());
resolver
.
setExposeRequestAttributes
(
isExposeRequestAttributes
());
resolver
.
setExposeRequestAttributes
(
isExposeRequestAttributes
());
resolver
.
setAllowRequestOverride
(
isAllowRequestOverride
());
resolver
.
setAllowRequestOverride
(
isAllowRequestOverride
());
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java
View file @
f0f5f78e
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
template
;
package
org
.
springframework
.
boot
.
autoconfigure
.
template
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -103,8 +101,13 @@ public abstract class AbstractViewResolverProperties {
...
@@ -103,8 +101,13 @@ public abstract class AbstractViewResolverProperties {
}
}
public
MimeType
getContentType
()
{
public
MimeType
getContentType
()
{
return
(
this
.
contentType
.
getCharSet
()
!=
null
?
this
.
contentType
:
if
(
this
.
contentType
.
getCharSet
()
==
null
)
{
new
MimeType
(
this
.
contentType
,
cloneParametersWithCustomCharset
(
this
.
contentType
,
this
.
charset
)));
Map
<
String
,
String
>
parameters
=
new
LinkedHashMap
<
String
,
String
>();
parameters
.
put
(
"charset"
,
this
.
charset
.
name
());
parameters
.
putAll
(
this
.
contentType
.
getParameters
());
return
new
MimeType
(
this
.
contentType
,
parameters
);
}
return
this
.
contentType
;
}
}
public
void
setContentType
(
MimeType
contentType
)
{
public
void
setContentType
(
MimeType
contentType
)
{
...
@@ -123,11 +126,4 @@ public abstract class AbstractViewResolverProperties {
...
@@ -123,11 +126,4 @@ public abstract class AbstractViewResolverProperties {
this
.
charset
=
charset
;
this
.
charset
=
charset
;
}
}
private
static
Map
<
String
,
String
>
cloneParametersWithCustomCharset
(
MimeType
contentType
,
Charset
charset
)
{
LinkedHashMap
<
String
,
String
>
clone
=
new
LinkedHashMap
<
String
,
String
>();
clone
.
put
(
"charset"
,
charset
.
name
());
clone
.
putAll
(
contentType
.
getParameters
());
return
clone
;
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
View file @
f0f5f78e
...
@@ -97,7 +97,9 @@ public class ThymeleafAutoConfiguration {
...
@@ -97,7 +97,9 @@ public class ThymeleafAutoConfiguration {
resolver
.
setPrefix
(
this
.
properties
.
getPrefix
());
resolver
.
setPrefix
(
this
.
properties
.
getPrefix
());
resolver
.
setSuffix
(
this
.
properties
.
getSuffix
());
resolver
.
setSuffix
(
this
.
properties
.
getSuffix
());
resolver
.
setTemplateMode
(
this
.
properties
.
getMode
());
resolver
.
setTemplateMode
(
this
.
properties
.
getMode
());
resolver
.
setCharacterEncoding
(
this
.
properties
.
getEncoding
().
name
());
if
(
this
.
properties
.
getEncoding
()
!=
null
)
{
resolver
.
setCharacterEncoding
(
this
.
properties
.
getEncoding
().
name
());
}
resolver
.
setCacheable
(
this
.
properties
.
isCache
());
resolver
.
setCacheable
(
this
.
properties
.
isCache
());
return
resolver
;
return
resolver
;
}
}
...
@@ -212,10 +214,10 @@ public class ThymeleafAutoConfiguration {
...
@@ -212,10 +214,10 @@ public class ThymeleafAutoConfiguration {
if
(
type
.
getCharSet
()
!=
null
)
{
if
(
type
.
getCharSet
()
!=
null
)
{
return
type
.
toString
();
return
type
.
toString
();
}
}
LinkedHashMap
<
String
,
String
>
clone
=
new
LinkedHashMap
<
String
,
String
>();
LinkedHashMap
<
String
,
String
>
parameters
=
new
LinkedHashMap
<
String
,
String
>();
clone
.
put
(
"charset"
,
charset
);
parameters
.
put
(
"charset"
,
charset
);
clone
.
putAll
(
type
.
getParameters
());
parameters
.
putAll
(
type
.
getParameters
());
return
new
MimeType
(
type
,
clone
).
toString
();
return
new
MimeType
(
type
,
parameters
).
toString
();
}
}
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafProperties.java
View file @
f0f5f78e
...
@@ -61,7 +61,7 @@ public class ThymeleafProperties {
...
@@ -61,7 +61,7 @@ public class ThymeleafProperties {
/**
/**
* Template encoding.
* Template encoding.
*/
*/
private
Charset
encoding
=
DEFAULT_ENCODING
;
private
Charset
encoding
=
DEFAULT_ENCODING
;
/**
/**
* Content-Type value.
* Content-Type value.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/ViewResolverPropertiesTest.java
View file @
f0f5f78e
...
@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.template;
...
@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.template;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.util.MimeTypeUtils
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
...
@@ -32,10 +31,10 @@ import static org.hamcrest.Matchers.hasToString;
...
@@ -32,10 +31,10 @@ import static org.hamcrest.Matchers.hasToString;
*/
*/
public
class
ViewResolverPropertiesTest
{
public
class
ViewResolverPropertiesTest
{
@Test
@Test
public
void
defaultContentType
()
{
public
void
defaultContentType
()
{
assertThat
(
new
ViewResolverProperties
().
getContentType
(),
hasToString
(
"text/html;charset=UTF-8"
));
assertThat
(
new
ViewResolverProperties
().
getContentType
(),
hasToString
(
"text/html;charset=UTF-8"
));
}
}
@Test
@Test
...
@@ -65,11 +64,12 @@ public class ViewResolverPropertiesTest {
...
@@ -65,11 +64,12 @@ public class ViewResolverPropertiesTest {
ViewResolverProperties
properties
=
new
ViewResolverProperties
();
ViewResolverProperties
properties
=
new
ViewResolverProperties
();
properties
.
setContentType
(
MimeTypeUtils
.
parseMimeType
(
"text/plain;foo=bar"
));
properties
.
setContentType
(
MimeTypeUtils
.
parseMimeType
(
"text/plain;foo=bar"
));
properties
.
setCharset
(
Charset
.
forName
(
"UTF-16"
));
properties
.
setCharset
(
Charset
.
forName
(
"UTF-16"
));
assertThat
(
properties
.
getContentType
(),
hasToString
(
"text/plain;charset=UTF-16;foo=bar"
));
assertThat
(
properties
.
getContentType
(),
hasToString
(
"text/plain;charset=UTF-16;foo=bar"
));
}
}
private
static
class
ViewResolverProperties
extends
AbstractViewResolverProperties
{
private
static
class
ViewResolverProperties
extends
AbstractViewResolverProperties
{
}
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
f0f5f78e
...
@@ -205,7 +205,8 @@ public class ServerPropertiesTests {
...
@@ -205,7 +205,8 @@ public class ServerPropertiesTests {
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"server.tomcat.uriEncoding"
,
"US-ASCII"
);
map
.
put
(
"server.tomcat.uriEncoding"
,
"US-ASCII"
);
bindProperties
(
map
);
bindProperties
(
map
);
assertEquals
(
Charset
.
forName
(
"US-ASCII"
),
this
.
properties
.
getTomcat
().
getUriEncoding
());
assertEquals
(
Charset
.
forName
(
"US-ASCII"
),
this
.
properties
.
getTomcat
()
.
getUriEncoding
());
}
}
@Test
@Test
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettings.java
View file @
f0f5f78e
...
@@ -74,8 +74,9 @@ public class MavenSettings {
...
@@ -74,8 +74,9 @@ public class MavenSettings {
private
final
List
<
Profile
>
activeProfiles
;
private
final
List
<
Profile
>
activeProfiles
;
/**
/**
* @param settings
* Create a new {@link MavenSettings} instance.
* @param decryptedSettings
* @param settings the source settings
* @param decryptedSettings the decrypted settings
*/
*/
public
MavenSettings
(
Settings
settings
,
SettingsDecryptionResult
decryptedSettings
)
{
public
MavenSettings
(
Settings
settings
,
SettingsDecryptionResult
decryptedSettings
)
{
this
.
offline
=
settings
.
isOffline
();
this
.
offline
=
settings
.
isOffline
();
...
@@ -166,7 +167,8 @@ public class MavenSettings {
...
@@ -166,7 +167,8 @@ public class MavenSettings {
org
.
apache
.
maven
.
model
.
Profile
modelProfile
=
new
org
.
apache
.
maven
.
model
.
Profile
();
org
.
apache
.
maven
.
model
.
Profile
modelProfile
=
new
org
.
apache
.
maven
.
model
.
Profile
();
modelProfile
.
setId
(
profile
.
getId
());
modelProfile
.
setId
(
profile
.
getId
());
if
(
profile
.
getActivation
()
!=
null
)
{
if
(
profile
.
getActivation
()
!=
null
)
{
modelProfile
.
setActivation
(
createModelActivation
(
profile
.
getActivation
()));
modelProfile
.
setActivation
(
createModelActivation
(
profile
.
getActivation
()));
}
}
modelProfiles
.
add
(
modelProfile
);
modelProfiles
.
add
(
modelProfile
);
}
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/MavenSettingsReader.java
View file @
f0f5f78e
...
@@ -91,15 +91,16 @@ public class MavenSettingsReader {
...
@@ -91,15 +91,16 @@ public class MavenSettingsReader {
return
settingsDecrypter
;
return
settingsDecrypter
;
}
}
private
void
setField
(
Class
<?>
clazz
,
String
fieldName
,
Object
target
,
Object
value
)
{
private
void
setField
(
Class
<?>
sourceClass
,
String
fieldName
,
Object
target
,
Object
value
)
{
try
{
try
{
Field
field
=
clazz
.
getDeclaredField
(
fieldName
);
Field
field
=
sourceClass
.
getDeclaredField
(
fieldName
);
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
field
.
set
(
target
,
value
);
field
.
set
(
target
,
value
);
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
x
)
{
throw
new
IllegalStateException
(
"Failed to set field '"
+
fieldName
throw
new
IllegalStateException
(
"Failed to set field '"
+
fieldName
+
"' on '"
+
target
+
"'"
,
e
);
+
"' on '"
+
target
+
"'"
,
e
x
);
}
}
}
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java
View file @
f0f5f78e
...
@@ -44,7 +44,6 @@ public final class RepositoryConfigurationFactory {
...
@@ -44,7 +44,6 @@ public final class RepositoryConfigurationFactory {
"spring-snapshot"
,
URI
.
create
(
"http://repo.spring.io/snapshot"
),
true
);
"spring-snapshot"
,
URI
.
create
(
"http://repo.spring.io/snapshot"
),
true
);
private
RepositoryConfigurationFactory
()
{
private
RepositoryConfigurationFactory
()
{
}
}
/**
/**
...
...
spring-boot-cli/src/test/resources/maven-settings/active-profile-repositories/.m2/settings.xml
View file @
f0f5f78e
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<password>
somepassword
</password>
<password>
somepassword
</password>
</proxy>
</proxy>
</proxies>
</proxies>
<profiles>
<profiles>
<profile>
<profile>
<id>
active-by-default
</id>
<id>
active-by-default
</id>
...
@@ -58,4 +58,4 @@
...
@@ -58,4 +58,4 @@
</profile>
</profile>
</profiles>
</profiles>
</settings>
</settings>
\ No newline at end of file
spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc
View file @
f0f5f78e
...
@@ -508,6 +508,8 @@ to configure Aether. The following configuration settings are honored by the CLI
...
@@ -508,6 +508,8 @@ to configure Aether. The following configuration settings are honored by the CLI
Please refer to https://maven.apache.org/settings.html[Maven's settings documentation] for
Please refer to https://maven.apache.org/settings.html[Maven's settings documentation] for
further information.
further information.
[[cli-whats-next]]
[[cli-whats-next]]
== What to read next
== What to read next
There are some {github-code}/spring-boot-cli/samples[sample groovy
There are some {github-code}/spring-boot-cli/samples[sample groovy
...
...
spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/DescriptionExtractor.java
View file @
f0f5f78e
...
@@ -26,7 +26,7 @@ import java.util.Locale;
...
@@ -26,7 +26,7 @@ import java.util.Locale;
*/
*/
class
DescriptionExtractor
{
class
DescriptionExtractor
{
static
final
String
NEW_LINE
=
System
.
getProperty
(
"line.separator"
);
private
static
final
String
NEW_LINE
=
System
.
getProperty
(
"line.separator"
);
public
String
getShortDescription
(
String
description
)
{
public
String
getShortDescription
(
String
description
)
{
if
(
description
==
null
)
{
if
(
description
==
null
)
{
...
...
spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/DescriptionExtractorTests.java
View file @
f0f5f78e
...
@@ -27,41 +27,42 @@ import static org.junit.Assert.assertEquals;
...
@@ -27,41 +27,42 @@ import static org.junit.Assert.assertEquals;
*/
*/
public
class
DescriptionExtractorTests
{
public
class
DescriptionExtractorTests
{
private
static
final
String
NEW_LINE
=
System
.
getProperty
(
"line.separator"
);
private
DescriptionExtractor
extractor
=
new
DescriptionExtractor
();
private
DescriptionExtractor
extractor
=
new
DescriptionExtractor
();
@Test
@Test
public
void
extractShortDescription
()
{
public
void
extractShortDescription
()
{
assertEquals
(
"My short description."
,
String
description
=
this
.
extractor
.
getShortDescription
(
"My short "
this
.
extractor
.
getShortDescription
(
"My short description. More stuff."
));
+
"description. More stuff."
);
assertEquals
(
"My short description."
,
description
);
}
}
@Test
@Test
public
void
extractShortDescriptionNewLineBeforeDot
()
{
public
void
extractShortDescriptionNewLineBeforeDot
()
{
assertEquals
(
"My short description."
,
String
description
=
this
.
extractor
.
getShortDescription
(
"My short"
+
NEW_LINE
this
.
extractor
.
getShortDescription
(
"My short"
+
DescriptionExtractor
.
NEW_LINE
+
+
"description."
+
NEW_LINE
+
"More stuff."
);
"description."
+
DescriptionExtractor
.
NEW_LINE
+
"More stuff."
)
);
assertEquals
(
"My short description."
,
description
);
}
}
@Test
@Test
public
void
extractShortDescriptionNewLineBeforeDotWithSpaces
()
{
public
void
extractShortDescriptionNewLineBeforeDotWithSpaces
()
{
assertEquals
(
"My short description."
,
String
description
=
this
.
extractor
.
getShortDescription
(
"My short "
+
NEW_LINE
this
.
extractor
+
" description. "
+
NEW_LINE
+
"More stuff."
);
.
getShortDescription
(
"My short "
assertEquals
(
"My short description."
,
description
);
+
DescriptionExtractor
.
NEW_LINE
+
" description. "
+
DescriptionExtractor
.
NEW_LINE
+
"More stuff."
));
}
}
@Test
@Test
public
void
extractShortDescriptionNoDot
()
{
public
void
extractShortDescriptionNoDot
()
{
assertEquals
(
"My short description"
,
String
description
=
this
.
extractor
.
getShortDescription
(
"My short description"
);
this
.
extractor
.
getShortDescription
(
"My short description"
)
);
assertEquals
(
"My short description"
,
description
);
}
}
@Test
@Test
public
void
extractShortDescriptionNoDotMultipleLines
()
{
public
void
extractShortDescriptionNoDotMultipleLines
()
{
assertEquals
(
"My short description"
,
String
description
=
this
.
extractor
.
getShortDescription
(
"My short description "
this
.
extractor
.
getShortDescription
(
"My short description "
+
NEW_LINE
+
" More stuff"
);
+
DescriptionExtractor
.
NEW_LINE
+
" More stuff"
)
);
assertEquals
(
"My short description"
,
description
);
}
}
@Test
@Test
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java
View file @
f0f5f78e
...
@@ -35,7 +35,8 @@ class ExpressionTree extends ReflectionWrapper {
...
@@ -35,7 +35,8 @@ class ExpressionTree extends ReflectionWrapper {
private
final
Class
<?>
methodInvocationTreeType
=
findClass
(
"com.sun.source.tree.MethodInvocationTree"
);
private
final
Class
<?>
methodInvocationTreeType
=
findClass
(
"com.sun.source.tree.MethodInvocationTree"
);
private
final
Method
methodInvocationArgumentsMethod
=
findMethod
(
this
.
methodInvocationTreeType
,
"getArguments"
);
private
final
Method
methodInvocationArgumentsMethod
=
findMethod
(
this
.
methodInvocationTreeType
,
"getArguments"
);
private
final
Class
<?>
newArrayTreeType
=
findClass
(
"com.sun.source.tree.NewArrayTree"
);
private
final
Class
<?>
newArrayTreeType
=
findClass
(
"com.sun.source.tree.NewArrayTree"
);
...
@@ -59,7 +60,8 @@ class ExpressionTree extends ReflectionWrapper {
...
@@ -59,7 +60,8 @@ class ExpressionTree extends ReflectionWrapper {
public
Object
getFactoryValue
()
throws
Exception
{
public
Object
getFactoryValue
()
throws
Exception
{
if
(
this
.
methodInvocationTreeType
.
isAssignableFrom
(
getInstance
().
getClass
()))
{
if
(
this
.
methodInvocationTreeType
.
isAssignableFrom
(
getInstance
().
getClass
()))
{
List
<?>
arguments
=
(
List
<?>)
this
.
methodInvocationArgumentsMethod
.
invoke
(
getInstance
());
List
<?>
arguments
=
(
List
<?>)
this
.
methodInvocationArgumentsMethod
.
invoke
(
getInstance
());
if
(
arguments
.
size
()
==
1
)
{
if
(
arguments
.
size
()
==
1
)
{
return
new
ExpressionTree
(
arguments
.
get
(
0
)).
getLiteralValue
();
return
new
ExpressionTree
(
arguments
.
get
(
0
)).
getLiteralValue
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment