Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devtools reload doesn't work with spring-boot-starter 1.4.2.RELEASE #7479

Closed
february opened this issue Nov 25, 2016 · 8 comments
Closed

Devtools reload doesn't work with spring-boot-starter 1.4.2.RELEASE #7479

february opened this issue Nov 25, 2016 · 8 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@february
Copy link

february commented Nov 25, 2016

hi
I am trying use STS to develop a simple spring boot application with spring-boot-starter 1.4.2.RELEASE.
after reading about the new dev tools introduction, i configured it in my project.
but it seems didn't work.
I found the issue#3315
perhaps it same as mine.
and then the Devtools reload worked vey well after i switched the spring-boot-starter to ver. 1.3.8.RELEASE.
why Devtools reload doesn't work with spring-boot-starter 1.4.2.RELEASE
any advice for me? thanks !!!

my pom file:

<?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">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.example</groupId>
	<artifactId>example</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>example</name>
	<description>Demo project for Spring Boot</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.2.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
                    <fork>true</fork>
                </configuration>
			</plugin>
		</plugins>
	</build>


</project>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 25, 2016
@snicoll
Copy link
Member

snicoll commented Nov 25, 2016

"It seems it does not work" is not really helping I am afraid. First of all if you are using STS you should start the application from STS rather than using the build plugin. If you want us to investigate, please explain what you've tried and why you believe it does not work.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Nov 25, 2016
@february
Copy link
Author

hi @snicoll
thanks for your reply.
I recorded my operation to youtube.
I think it useful.

let me explain what i did.
first i create a simple spring boot project by STS.
and this video will show my project configuration about Devtools.
youtube video about project creation

and then, i added a rest controller class, and run it successfully.
youtube video about my simple controller

the last,i edit controller's source code,but i can't see any message about reload in console window.
of course,that is no change in the browser.
youtube video about didn't reload

i hope you can help me
thanks a lot!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 25, 2016
@wilkinsona
Copy link
Member

As far as I can tell, what you have shown should work. When you start your application as a Spring Boot App you should see some threads named restartedMain in the log output:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                        

2016-11-25 10:49:06.666  INFO 80773 --- [  restartedMain] s.devtools.SampleDevToolsApplication     : Starting SampleDevToolsApplication on aw-rmbp.home with PID 80773 (/Users/awilkinson/dev/spring/spring-boot/1.5.x/spring-boot-samples/spring-boot-sample-devtools/target/classes started by awilkinson in /Users/awilkinson/dev/spring/spring-boot/1.5.x/spring-boot-samples/spring-boot-sample-devtools)
2016-11-25 10:49:06.670  INFO 80773 --- [  restartedMain] s.devtools.SampleDevToolsApplication     : No active profile set, falling back to default profiles: default
2016-11-25 10:49:06.905  INFO 80773 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4546ce7a: startup date [Fri Nov 25 10:49:06 GMT 2016]; root of context hierarchy
2016-11-25 10:49:07.930  INFO 80773 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-11-25 10:49:07.939  INFO 80773 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service Tomcat
2016-11-25 10:49:07.940  INFO 80773 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.6

I wonder if the spring-boot-devtools jar got corrupted when Maven downloaded it. Can you try clearing out Maven's cache and rebuilding your app?

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Nov 25, 2016
@february
Copy link
Author

february commented Nov 25, 2016

hi, @wilkinsona
you are right 👍 , it became work normally after clean out cache and rebuild the app.
but,we must take note of a detail of pom file :
the configure about devtools whitch generated by STS is lost the <optional>true</optional>
e.g.

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
		</dependency>

as in my case, spring-boot-devtools can't work normally if pom file lost the <optional>true</optional> .
is it STS's issue?

however, thanks for your help!! 👍 ( to @wilkinsona @snicoll )

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 25, 2016
@february
Copy link
Author

i think this is right way to config spring-boot-devtools

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
			<scope>runtime</scope>
		</dependency>

is it ok?

@snicoll
Copy link
Member

snicoll commented Nov 25, 2016

@february please use stackoverflow for questions. I am not aware of any problem with the runtime scope but it looks like it's an IDE configuration issue.

@snicoll snicoll closed this as completed Nov 25, 2016
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Nov 25, 2016
@february
Copy link
Author

@snicoll sorry, i am foolish to make a mistake.
i think it is problem that the pom file lost the <optional>true</optional> ,
not the runtime scope.

@Arisono
Copy link

Arisono commented Mar 14, 2018

我已经解决了这个问题,中文的朋友请查阅 简书:https://www.jianshu.com/p/087668f20945

@spring-projects spring-projects locked and limited conversation to collaborators Mar 14, 2018
@spring-projects spring-projects deleted a comment from february Mar 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants