Building and Running

Create executable jar

Add this to pom.xml to create executable jar
<build>
                <plugins>
                        <plugin>
                                <groupId>org.springframework.boot</groupId>
                                <artifactId>spring-boot-maven-plugin</artifactId>
                                <configuration>
                                        <executable>true</executable>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

Set different environment

  • Create a .conf file with the SAME name at location of the executable jar

  • Fill the context of the conf file with something like the following

JAVA_OPTS="-Dspring.profiles.active=acceptance"
  • Restart app and it runs with environment acceptance

Additional methods in JPA

Dynamic finders

Bird findByNameAndAge(String name, int age);

Update all rows

  @Modifying
        @Query("update AuthenticationToken set expired=true")
        void expireAll();

Delete some

@Modifying
        @Query("delete from AuthenticationToken where expired=true")
        void deleteExpiredTokens();

Delete all

  @Modifying // means that this is a modifying query
        @Query("delete from Bird")
        Integer clear();
All your rows will be deleted from the table