Skip to content
Advertisement

Tag: spring

Spring @PropertySource cannot be opened because it does not exist

I have simple spring application. Spring version is 3.2.16.RELEASE. Project structure is: . Application class looks like: When I try to run it I have: I have trying: and other… Resources folder is marked as resource root… Intellij project structure is ok. Any ideas what can be wrong? Did I missed something? Thanks in advice! Answer Try to add absolute

Invalid flag -parameters in java 1.7

I have the task to create the spring-boot application using Java 7. So, as usual, I created a template on start.spring.io resource and open him via File -> New -> Project from Existing Sources… When I run with jdk-8, everything works fine, but when I change JDK to version 1.7 (also I change java-version in pom.xml) I get a compilation

How do I force a Spring Boot JVM into UTC time zone?

I saw Force Java timezone as GMT/UTC I tried mvn spring-boot:run -Dexec.args=”-Duser.timezone=GMT” mvn spring-boot:run -Dexec.args=”-Duser.timezone=UTC” user.timezone=UTC in config/application.properties user.timezone=GMT In the pom.xml: mvn spring-boot:run -Dspring-boot.run.jvmArguments=”-Duser.timezone=UTC” But it prints out sun.util.calendar.ZoneInfo[id=”America/New_York”,offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]] Spring Boot 1.5.19, Java 8 Answer Use spring-boot.run.jvmArguments property if you want to pass JVM options from Maven Spring Boot Plugin to forked Spring Boot application: This is be equivalent

Spring: Check if a classpath resource exists before loading

I have a code where I need to check if a classpath resource exists and apply some actions. Problem: ResourceUtils.getFile() throws FileNotFoundException if the resource doesn’t exist. At the same time I don’t want to use exceptions for code flow and I’d like to check if a resource exists. Question: Is there any way to check if a resource exists

How to get the value from system property in spring boot

I am using following command to run my spring boot application Currently, I am able to access it via following command like below However I need to access it via any annotation in Spring something like @value(${library.system.property}) I tried to use But the value of the property is null. Do I need to use conditional bean or something? Answer Thanks

How to @Autowired BuildProperties in test?

I am using this annotation to display the build version in my app: With this maven plugin: It works well in the app, but prevent my test to run. Here is the test class config: I add the file src/test/resources/META-INF/build-info.properties But the build still have errors: How can I make this works during test ? Solution: add the annotation @SpringBootTest

Advertisement