In some cases, you may want to fail startup of a Spring Boot application if it cannot connect to the Config Server. You can do that setting the bootstrap configuration property spring.cloud.config.fail-fast=true. In this way the client startup halt with an Exception. Config server may occasionally be unavailable when your application starts, you can make […]

Read More →

If you find you are repeatedly using the same attributes with @Transactional on many different methods, then Spring’s meta-annotation support allows you to define custom shortcut annotations for your specific use cases. For example, defining the following annotations: allows us to write the example from the previous section as As you can see meta-annotations can […]

Read More →

Sometimes it can be useful to run a python script at boot time. This can be done writing an init script and using start-stop-daemon command to launch your script as daemon in backgound. Moreover start-stop-daemon allow you to perform serveral operation like start, stop and restart of your script. The following example was implemented on […]

Read More →

Sometimes it can be usefull inject the Spring context in a legacy Servlet in order to automatically inject spring beans via @Autowired annotation. This can be easily done overriding the init method of HttpServlet and putting the statement SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this) in its implementation.

Read More →