I'm trying to figure out how the project works.
It uses Liquibase:
The problem is that the .yaml file is not in the classpath folder so it's not accessible.
Error:
How to let Spring Boot know where is the change-log?
Use property name as
spring.liquibase.changeLog
not
liquibase.changeLog
Related
I have setup a run configuration in eclipse but it's running in localhost:8080 but I want it to run in localhost:8080/demo/ but it's not working. I have attached the run configuration and application properties file
can anyone help me to run spring boot project in localhost:8080/demo/
I think that you can just add this to your properties file
server.servlet.context-path=/demo
In your controller by annotation #RequestMapping(path = "/demo") or by annotation on method #GetMapping("/demo")
I have to run a legacy spring boot (2.1.8) app
SpringApplication.run(MyApplication.class, args);
with XML beans config which must be selected at runtime from the src/main/resources dir:
a/config.xml
or
b/config.xml
based on an env variable with the respective value a or b. Is there a way to load XML config like this?
Have you looked into Spring Profiles; this might get you where you want to be.
I am newbie with Springboot .I am unable to make jar file of Springboot with Mysql to deploy in AWS using Eclipse IDE.
I create an application which work perfectly fine in Localhost and when i want to deploy it into the AWS I comment all my application.properties file which has code like
#spring.jpa.hibernate.ddl-auto=update
#spring.datasource.url=jdbc:mysql://localhost:3306/db_digitalprofile?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=
#server.port=9090
#spring.jpa.show-sql = true
#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
and make a new file named as application-prod.properties in src/main/resource with the code:
server.port=5000
spring.datasource.url=jdbc:mysql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
spring.datasource.username=${RDS_USERNAME}
spring.datasource.password=${RDS_PASSWORD}
spring.jpa.hibernate.ddl-auto=update
Now when i want to make a jar file from right click on project> Run As>Maven install to create a jar file it throw a error like:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
java.lang.IllegalStateException: Failed to load ApplicationContext
I had also add following dependency in pom.xml
<configuration>
<finalName> digitalProfile</finalName>
</configuration>
Failed to determine a suitable driver class
You need to check the dependencies. No driver found meaning, driver jar is missing which will be used to connect to Database. mysql driver should be present in your pom file or whatever your build file is.
Add this on your application.properties and it should fix your issue.
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
I am using Spring Boot 2.2.2 with Flyway 5.2.4 and I tried to configure flyway to use a differente location for the scripts, but spring.flyway.locations=filesystem:db_other/migration/{vendor} neither flyway.locations=filesystem:db_other/migration/{vendor} configurations on application.properties worked.
When running the program, the following exception appear in the log:
FlywayMigrationScriptMissingException: Cannot find migration scripts in: [classpath:db/migration]
I already tried using Spring Boot 2.2.1, 2.2.0, 2.1.11 and Flyway 6.1.0 and 6.1.3, but the result is the same.
The default value for that property is classpath:db/migration as shown here (search for flyway).
Since you're using a different folder in the resources directory you should only need to change "filesystem" to "classpath" in your application.properties value.
Actually if was my fault: as I used to work with just spring (not spring boot) I configured my test class with the annotations #ExtendWith(SpringExtension.class) AND #ContextConfiguration(classes = { MyConfiguration.class }) instead of just use #SpringBootTest. When making this change the test worked.
I am working on a migrating an old Spring XML config-based app to Spring Boot and there are third party jars which have #Value("$ properties referenced in them. I tried loading a custom property file placed under /resources in the new Spring Boot workspace and loading it with #PropertySource("classpath:file") but during the Spring Boot run the property does not seem to be loaded and get this below error:
Could not resolve placeholder 'com.example.propertyName' in value "${com.example.propertyName}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
You can bind the properties values using annotation #Value then mentioned the key on it.
you can follow the below link for end to end example
click