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
b69c659d
Commit
b69c659d
authored
Feb 19, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
d84a77e4
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
128 additions
and
105 deletions
+128
-105
pom.xml
pom.xml
+14
-7
ManagementServerProperties.java
...oot/actuate/autoconfigure/ManagementServerProperties.java
+6
-4
AuthenticationAuditListener.java
...rk/boot/actuate/security/AuthenticationAuditListener.java
+4
-5
pom.xml
spring-boot-dependencies/pom.xml
+12
-11
pom.xml
spring-boot-parent/pom.xml
+2
-1
pom.xml
spring-boot-samples/pom.xml
+4
-2
build.gradle
spring-boot-samples/spring-boot-sample-web-ui/build.gradle
+16
-18
pom.xml
spring-boot-samples/spring-boot-sample-web-ui/pom.xml
+2
-1
pom.xml
spring-boot-starters/spring-boot-starter/pom.xml
+2
-1
SpringBootPluginExtension.groovy
...ingframework/boot/gradle/SpringBootPluginExtension.groovy
+1
-3
ComputeMain.java
...ovy/org/springframework/boot/gradle/task/ComputeMain.java
+9
-7
RunApp.java
...n/groovy/org/springframework/boot/gradle/task/RunApp.java
+3
-2
RunWithAgent.java
...vy/org/springframework/boot/gradle/task/RunWithAgent.java
+30
-26
pom.xml
spring-boot-tools/spring-boot-loader-tools/pom.xml
+2
-1
AgentAttacher.java
.../org/springframework/boot/loader/tools/AgentAttacher.java
+7
-7
RunMojo.java
...src/main/java/org/springframework/boot/maven/RunMojo.java
+8
-4
README.md
spring-boot/README.md
+1
-1
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+2
-2
JettyServerCustomizer.java
...rk/boot/context/embedded/jetty/JettyServerCustomizer.java
+1
-1
JettyEmbeddedServletContainerFactoryTests.java
...dded/jetty/JettyEmbeddedServletContainerFactoryTests.java
+2
-1
No files found.
pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-build
</artifactId>
...
...
@@ -95,15 +96,20 @@
<taskdef
resource=
"net/sf/antcontrib/antcontrib.properties"
/>
<taskdef
name=
"stringutil"
classname=
"ise.antelope.tasks.StringUtilTask"
/>
<var
name=
"version-type"
value=
"${project.version}"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
".*\.(.*)"
replace=
"\1"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"(M)\d+"
replace=
"MILESTONE"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"(RC)\d+"
replace=
"MILESTONE"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"BUILD-(.*)"
replace=
"SNAPSHOT"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
".*\.(.*)"
replace=
"\1"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"(M)\d+"
replace=
"MILESTONE"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"(RC)\d+"
replace=
"MILESTONE"
/>
<propertyregex
property=
"version-type"
override=
"true"
input=
"${version-type}"
regexp=
"BUILD-(.*)"
replace=
"SNAPSHOT"
/>
<stringutil
string=
"${version-type}"
property=
"profile"
>
<lowercase
/>
</stringutil>
<echo
message=
"Writing settings for ${profile} profile"
/>
<copy
file=
".settings-template.xml"
tofile=
"settings.xml"
overwrite=
"true"
>
<copy
file=
".settings-template.xml"
tofile=
"settings.xml"
overwrite=
"true"
>
<filterset>
<filter
token=
"profile"
value=
"${profile}"
/>
</filterset>
...
...
@@ -120,7 +126,8 @@
<inherited>
false
</inherited>
<configuration>
<target>
<property
name=
"sourceFile"
value=
"spring-boot-starters/spring-boot-starter-parent/pom.xml"
/>
<property
name=
"sourceFile"
value=
"spring-boot-starters/spring-boot-starter-parent/pom.xml"
/>
<xslt
in=
"${sourceFile}"
out=
"${sourceFile}.new"
force=
"true"
>
<style>
<string>
<![CDATA[
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
View file @
b69c659d
...
...
@@ -35,6 +35,8 @@ import org.springframework.util.ClassUtils;
@ConfigurationProperties
(
name
=
"management"
,
ignoreUnknownFields
=
false
)
public
class
ManagementServerProperties
implements
SecurityPrequisite
{
private
static
final
String
SECURITY_CHECK_CLASS
=
"org.springframework.security.config.http.SessionCreationPolicy"
;
private
Integer
port
;
private
InetAddress
address
;
...
...
@@ -119,9 +121,9 @@ public class ManagementServerProperties implements SecurityPrequisite {
}
private
static
Security
maybeCreateSecurity
()
{
return
(
ClassUtils
.
isPresent
(
"org.springframework.security.config.http.SessionCreationPolicy"
,
null
)
?
new
Security
()
:
null
);
if
(
ClassUtils
.
isPresent
(
SECURITY_CHECK_CLASS
,
null
))
{
return
new
Security
();
}
return
null
;
}
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -38,6 +38,8 @@ import org.springframework.util.ClassUtils;
public
class
AuthenticationAuditListener
implements
ApplicationListener
<
AbstractAuthenticationEvent
>,
ApplicationEventPublisherAware
{
private
static
final
String
WEB_LISTENER_CHECK_CLASS
=
"org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent"
;
private
ApplicationEventPublisher
publisher
;
private
WebAuditListener
webListener
=
maybeCreateWebListener
();
...
...
@@ -48,10 +50,7 @@ public class AuthenticationAuditListener implements
}
private
static
WebAuditListener
maybeCreateWebListener
()
{
if
(
ClassUtils
.
isPresent
(
"org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent"
,
null
))
{
if
(
ClassUtils
.
isPresent
(
WEB_LISTENER_CHECK_CLASS
,
null
))
{
return
new
WebAuditListener
();
}
return
null
;
...
...
spring-boot-dependencies/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
...
...
@@ -215,11 +216,11 @@
<artifactId>
groovy-xml
</artifactId>
<version>
${groovy.version}
</version>
</dependency>
<dependency>
<groupId>
org.codehaus.groovy
</groupId>
<artifactId>
groovy-templates
</artifactId>
<version>
${groovy.version}
</version>
</dependency>
<dependency>
<groupId>
org.codehaus.groovy
</groupId>
<artifactId>
groovy-templates
</artifactId>
<version>
${groovy.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-webapp
</artifactId>
...
...
@@ -286,11 +287,11 @@
<artifactId>
mongo-java-driver
</artifactId>
<version>
${mongodb.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectreactor
</groupId>
<artifactId>
reactor-core
</artifactId>
<version>
${reactor.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectreactor
</groupId>
<artifactId>
reactor-core
</artifactId>
<version>
${reactor.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectreactor
</groupId>
<artifactId>
reactor-spring
</artifactId>
...
...
spring-boot-parent/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-samples/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -38,7 +39,8 @@
<module>
spring-boot-sample-websocket
</module>
<module>
spring-boot-sample-xml
</module>
</modules>
<!-- No dependencies - otherwise the samples won't work if you change the parent -->
<!-- No dependencies - otherwise the samples won't work if you change the
parent -->
<build>
<plugins>
<plugin>
...
...
spring-boot-samples/spring-boot-sample-web-ui/build.gradle
View file @
b69c659d
...
...
@@ -3,14 +3,14 @@ buildscript {
springBootVersion
=
'1.0.0.BUILD-SNAPSHOT'
springLoadedVersion
=
'1.1.5.RELEASE'
}
repositories
{
mavenLocal
()
maven
{
url
"http://repo.springsource.org/libs-snapshot"
}
}
dependencies
{
classpath
(
"org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
)
classpath
(
"org.springsource.loaded:springloaded:${springLoadedVersion}"
)
}
repositories
{
mavenLocal
()
maven
{
url
"http://repo.springsource.org/libs-snapshot"
}
}
dependencies
{
classpath
(
"org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
)
classpath
(
"org.springsource.loaded:springloaded:${springLoadedVersion}"
)
}
}
...
...
@@ -22,21 +22,19 @@ apply plugin: 'spring-boot'
mainClassName
=
"sample.ui.SampleWebUiApplication"
jar
{
baseName
=
'spring-boot-sample-simple'
version
=
'0.5.0'
baseName
=
'spring-boot-sample-simple'
version
=
'0.5.0'
}
repositories
{
mavenCentral
()
maven
{
url
"http://repo.springsource.org/libs-snapshot"
}
mavenCentral
()
maven
{
url
"http://repo.springsource.org/libs-snapshot"
}
}
dependencies
{
compile
(
"org.springframework.boot:spring-boot-starter-thymeleaf"
)
compile
(
"org.hibernate:hibernate-validator"
)
testCompile
(
"org.springframework.boot:spring-boot-starter-test"
)
compile
(
"org.springframework.boot:spring-boot-starter-thymeleaf"
)
compile
(
"org.hibernate:hibernate-validator"
)
testCompile
(
"org.springframework.boot:spring-boot-starter-test"
)
}
task
wrapper
(
type:
Wrapper
)
{
gradleVersion
=
'1.6'
}
task
wrapper
(
type:
Wrapper
)
{
gradleVersion
=
'1.6'
}
spring-boot-samples/spring-boot-sample-web-ui/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
...
...
spring-boot-starters/spring-boot-starter/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPluginExtension.groovy
View file @
b69c659d
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.gradle
import
org.springframework.boot.loader.tools.Layout
import
org.springframework.boot.loader.tools.Layouts
/**
* Gradle DSL Extension for 'Spring Boot'. Most of the time Spring Boot can guess the
* settings in this extension, but occasionally you might need to explicitly set one
...
...
@@ -98,7 +97,7 @@ public class SpringBootPluginExtension {
Layout
convertLayout
()
{
(
layout
==
null
?
null
:
layout
.
layout
)
}
/**
* Location of an agent jar to attach to the VM when running the application with runJar task.
*/
...
...
@@ -108,5 +107,4 @@ public class SpringBootPluginExtension {
* Flag to indicate that the agent requires -noverify (and the plugin will refuse to start if it is not set)
*/
Boolean
noverify
;
}
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/ComputeMain.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -44,7 +44,7 @@ public class ComputeMain implements Action<Task> {
public
void
execute
(
Task
task
)
{
if
(
task
instanceof
JavaExec
)
{
final
JavaExec
exec
=
(
JavaExec
)
task
;
project
.
afterEvaluate
(
new
Action
<
Project
>()
{
this
.
project
.
afterEvaluate
(
new
Action
<
Project
>()
{
@Override
public
void
execute
(
Project
project
)
{
addMain
(
exec
);
...
...
@@ -54,9 +54,9 @@ public class ComputeMain implements Action<Task> {
}
private
void
addMain
(
JavaExec
exec
)
{
if
(
exec
.
getMain
()
==
null
)
{
project
.
getLogger
().
debug
(
"Computing main for: "
+
exec
);
project
.
setProperty
(
"mainClassName"
,
findMainClass
(
project
));
if
(
exec
.
getMain
()
==
null
)
{
this
.
project
.
getLogger
().
debug
(
"Computing main for: "
+
exec
);
this
.
project
.
setProperty
(
"mainClassName"
,
findMainClass
(
this
.
project
));
}
}
...
...
@@ -65,9 +65,11 @@ public class ComputeMain implements Action<Task> {
if
(
main
==
null
)
{
return
null
;
}
project
.
getLogger
().
debug
(
"Looking for main in: "
+
main
.
getOutput
().
getClassesDir
());
project
.
getLogger
().
debug
(
"Looking for main in: "
+
main
.
getOutput
().
getClassesDir
());
try
{
String
mainClass
=
MainClassFinder
.
findMainClass
(
main
.
getOutput
().
getClassesDir
());
String
mainClass
=
MainClassFinder
.
findMainClass
(
main
.
getOutput
()
.
getClassesDir
());
project
.
getLogger
().
info
(
"Computed main class: "
+
mainClass
);
return
mainClass
;
}
...
...
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/RunApp.java
View file @
b69c659d
...
...
@@ -42,7 +42,7 @@ public class RunApp extends DefaultTask {
@TaskAction
public
void
runApp
()
{
final
Project
project
=
getProject
();
final
SourceSet
main
=
ComputeMain
.
findMainSourceSet
(
project
);
...
...
@@ -52,7 +52,8 @@ public class RunApp extends DefaultTask {
SourceDirectorySet
resources
=
main
.
getResources
();
allResources
.
addAll
(
resources
.
getSrcDirs
());
outputs
=
main
.
getOutput
().
getResourcesDir
();
}
else
{
}
else
{
outputs
=
null
;
}
...
...
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/task/RunWithAgent.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -41,6 +41,8 @@ import org.springframework.core.task.TaskRejectedException;
*/
public
class
RunWithAgent
implements
Action
<
Task
>
{
private
static
final
String
SPRING_LOADED_AGENT_CLASSNAME
=
"org.springsource.loaded.agent.SpringLoadedAgent"
;
private
File
agent
;
private
Project
project
;
...
...
@@ -52,39 +54,40 @@ public class RunWithAgent implements Action<Task> {
}
@Override
public
void
execute
(
Task
task
)
{
public
void
execute
(
final
Task
task
)
{
if
(
task
instanceof
JavaExec
)
{
final
JavaExec
exec
=
(
JavaExec
)
task
;
project
.
afterEvaluate
(
new
Action
<
Project
>()
{
this
.
project
.
afterEvaluate
(
new
Action
<
Project
>()
{
@Override
public
void
execute
(
Project
project
)
{
addAgent
(
exec
);
addAgent
(
(
JavaExec
)
task
);
}
});
}
if
(
task
instanceof
RunApp
)
{
final
RunApp
exec
=
(
RunApp
)
task
;
project
.
beforeEvaluate
(
new
Action
<
Project
>()
{
this
.
project
.
beforeEvaluate
(
new
Action
<
Project
>()
{
@Override
public
void
execute
(
Project
project
)
{
addAgent
(
exec
);
addAgent
(
(
RunApp
)
task
);
}
});
}
}
private
void
addAgent
(
RunApp
exec
)
{
project
.
getLogger
().
debug
(
"Attaching to: "
+
exec
);
findAgent
(
project
.
getExtensions
().
getByType
(
SpringBootPluginExtension
.
class
));
this
.
project
.
getLogger
().
debug
(
"Attaching to: "
+
exec
);
findAgent
(
this
.
project
.
getExtensions
().
getByType
(
SpringBootPluginExtension
.
class
));
if
(
this
.
agent
!=
null
)
{
exec
.
doFirst
(
new
Action
<
Task
>()
{
@Override
public
void
execute
(
Task
task
)
{
project
.
getLogger
().
info
(
RunWithAgent
.
this
.
project
.
getLogger
().
info
(
"Attaching agent: "
+
RunWithAgent
.
this
.
agent
);
if
(
RunWithAgent
.
this
.
noverify
!=
null
&&
RunWithAgent
.
this
.
noverify
&&
!
AgentAttacher
.
hasNoVerify
())
{
if
(
RunWithAgent
.
this
.
noverify
!=
null
&&
RunWithAgent
.
this
.
noverify
&&
!
AgentAttacher
.
hasNoVerify
())
{
throw
new
TaskRejectedException
(
"The JVM must be started with -noverify for this agent to work. You can use JAVA_OPTS to add that flag."
);
"The JVM must be started with -noverify for this "
+
"agent to work. You can use JAVA_OPTS "
+
"to add that flag."
);
}
AgentAttacher
.
attach
(
RunWithAgent
.
this
.
agent
);
}
...
...
@@ -93,10 +96,10 @@ public class RunWithAgent implements Action<Task> {
}
private
void
addAgent
(
JavaExec
exec
)
{
project
.
getLogger
().
debug
(
"Attaching to: "
+
exec
);
findAgent
(
project
.
getExtensions
().
getByType
(
SpringBootPluginExtension
.
class
));
this
.
project
.
getLogger
().
debug
(
"Attaching to: "
+
exec
);
findAgent
(
this
.
project
.
getExtensions
().
getByType
(
SpringBootPluginExtension
.
class
));
if
(
this
.
agent
!=
null
)
{
project
.
getLogger
().
info
(
"Attaching agent: "
+
this
.
agent
);
this
.
project
.
getLogger
().
info
(
"Attaching agent: "
+
this
.
agent
);
exec
.
jvmArgs
(
"-javaagent:"
+
this
.
agent
.
getAbsolutePath
());
if
(
this
.
noverify
!=
null
&&
this
.
noverify
)
{
exec
.
jvmArgs
(
"-noverify"
);
...
...
@@ -108,20 +111,20 @@ public class RunWithAgent implements Action<Task> {
if
(
this
.
agent
!=
null
)
{
return
;
}
this
.
noverify
=
project
.
getExtensions
()
this
.
noverify
=
this
.
project
.
getExtensions
()
.
getByType
(
SpringBootPluginExtension
.
class
).
getNoverify
();
project
.
getLogger
().
info
(
"Finding agent"
);
if
(
project
.
hasProperty
(
"run.agent"
))
{
this
.
agent
=
project
.
file
(
project
.
property
(
"run.agent"
));
}
else
if
(
extension
.
getAgent
()
!=
null
)
{
this
.
project
.
getLogger
().
info
(
"Finding agent"
);
if
(
this
.
project
.
hasProperty
(
"run.agent"
))
{
this
.
agent
=
this
.
project
.
file
(
this
.
project
.
property
(
"run.agent"
));
}
else
if
(
extension
.
getAgent
()
!=
null
)
{
this
.
agent
=
extension
.
getAgent
();
}
if
(
this
.
agent
==
null
)
{
try
{
Class
<?>
loaded
=
Class
.
forName
(
"org.springsource.loaded.agent.SpringLoadedAgent"
);
Class
<?>
loaded
=
Class
.
forName
(
SPRING_LOADED_AGENT_CLASSNAME
);
if
(
this
.
agent
==
null
&&
loaded
!=
null
)
{
if
(
this
.
noverify
==
null
)
{
if
(
this
.
noverify
==
null
)
{
this
.
noverify
=
true
;
}
CodeSource
source
=
loaded
.
getProtectionDomain
().
getCodeSource
();
...
...
@@ -129,11 +132,12 @@ public class RunWithAgent implements Action<Task> {
this
.
agent
=
new
File
(
source
.
getLocation
().
getFile
());
}
}
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
ex
)
{
// ignore;
}
}
project
.
getLogger
().
debug
(
"Agent: "
+
this
.
agent
);
this
.
project
.
getLogger
().
debug
(
"Agent: "
+
this
.
agent
);
}
}
spring-boot-tools/spring-boot-loader-tools/pom.xml
View file @
b69c659d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/AgentAttacher.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -23,22 +23,22 @@ import java.util.List;
import
com.sun.tools.attach.VirtualMachine
;
/**
* Utility class to attach an instrumentation agent to the running JVM.
*
* @author Dave Syer
*/
public
abstract
class
AgentAttacher
{
public
static
void
attach
(
File
agent
)
{
String
nameOfRunningVM
=
ManagementFactory
.
getRuntimeMXBean
().
getName
();
int
p
=
nameOfRunningVM
.
indexOf
(
'@'
);
String
pid
=
nameOfRunningVM
.
substring
(
0
,
p
);
String
name
=
ManagementFactory
.
getRuntimeMXBean
().
getName
();
String
pid
=
name
.
substring
(
0
,
name
.
indexOf
(
'@'
));
try
{
VirtualMachine
vm
=
VirtualMachine
.
attach
(
pid
);
vm
.
loadAgent
(
agent
.
getAbsolutePath
());
vm
.
detach
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
catch
(
Exception
e
x
)
{
throw
new
RuntimeException
(
e
x
);
}
}
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -49,6 +49,11 @@ import org.springframework.boot.loader.tools.MainClassFinder;
@Execute
(
phase
=
LifecyclePhase
.
TEST_COMPILE
)
public
class
RunMojo
extends
AbstractMojo
{
/**
*
*/
private
static
final
String
SPRING_LOADED_AGENT_CLASSNAME
=
"org.springsource.loaded.agent.SpringLoadedAgent"
;
/**
* The Maven project.
*/
...
...
@@ -120,8 +125,7 @@ public class RunMojo extends AbstractMojo {
private
void
findAgent
()
{
try
{
Class
<?>
loaded
=
Class
.
forName
(
"org.springsource.loaded.agent.SpringLoadedAgent"
);
Class
<?>
loaded
=
Class
.
forName
(
SPRING_LOADED_AGENT_CLASSNAME
);
if
(
this
.
agent
==
null
&&
loaded
!=
null
)
{
if
(
this
.
noverify
==
null
)
{
this
.
noverify
=
true
;
...
...
@@ -132,7 +136,7 @@ public class RunMojo extends AbstractMojo {
}
}
}
catch
(
ClassNotFoundException
e
)
{
catch
(
ClassNotFoundException
e
x
)
{
// ignore;
}
}
...
...
spring-boot/README.md
View file @
b69c659d
...
...
@@ -257,7 +257,7 @@ archive, there are some limitations in the JSP support.
executable WAR will work, and will also be deployable to a standard
container (Tomcat included). An executable JAR will not work because
of a hard coded file patter in Tomcat itself.
*
Jetty does not currently work as an embedded container with
JSPs. There should be a way to make it work, so hopefully someone
can figure it out (pull requests always welcome).
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
b69c659d
...
...
@@ -262,7 +262,7 @@ public class JettyEmbeddedServletContainerFactory extends
*/
public
void
setServerCustomizers
(
Collection
<?
extends
JettyServerCustomizer
>
customizers
)
{
Assert
.
notNull
(
customizers
,
"
JettyServer
Customizers must not be null"
);
Assert
.
notNull
(
customizers
,
"Customizers must not be null"
);
this
.
jettyServerCustomizers
=
new
ArrayList
<
JettyServerCustomizer
>(
customizers
);
}
...
...
@@ -281,7 +281,7 @@ public class JettyEmbeddedServletContainerFactory extends
* @param customizers the customizers to add
*/
public
void
addServerCustomizers
(
JettyServerCustomizer
...
customizers
)
{
Assert
.
notNull
(
customizers
,
"C
onfiguration
s must not be null"
);
Assert
.
notNull
(
customizers
,
"C
ustomizer
s must not be null"
);
this
.
jettyServerCustomizers
.
addAll
(
Arrays
.
asList
(
customizers
));
}
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyServerCustomizer.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java
View file @
b69c659d
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
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.
...
...
@@ -38,6 +38,7 @@ import static org.mockito.Mockito.mock;
* {@link JettyEmbeddedServletContainer}.
*
* @author Phillip Webb
* @author Dave Syer
*/
public
class
JettyEmbeddedServletContainerFactoryTests
extends
AbstractEmbeddedServletContainerFactoryTests
{
...
...
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