spring-loaded
spring-loaded copied to clipboard
using spring loaded but spring.profiles.active not work
this is my run shell script
@echo off
echo [INFO] Runing...
cd %~dp0
cd ..
set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,suspend=n,server=y -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dspring.profiles.active=local -Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.Log4JLogger
set JAVA_OPTS=-Dspring.profiles.active=local
call mvn spring-boot:run
pause
and this is my springloaded configuration
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
</dependencies>
</plugin>
if i run the start script without spring loaded ,spring can get the maven_opts.but it can't be get the opts when springloaded is active. i don't know the reason of the problem.
it's because when you include spring-loaded as a dependency for spring-boot-plugin, it creates separate process(to activate javaagent), and that process environment doesn't have that variable set. Try to set variable somewhere more "global".