Define an in-memory JobRepository

With SpringBoot 2.x, the solution is simpler. You have to extend the DefaultBatchConfigurer class like this: @Component public class NoPersistenceBatchConfigurer extends DefaultBatchConfigurer { @Override public void setDataSource(DataSource dataSource) { } } Without datasource, the framework automatically switches to use the MapJobRepository.

Load spring boot app properties from database

For those who need load properties from database before application starts, and make those props accesible by @Value anywhere in your project, just add this processor. public class ReadDbPropertiesPostProcessor implements EnvironmentPostProcessor { /** * Name of the custom property source added by this post processor class */ private static final String PROPERTY_SOURCE_NAME = “databaseProperties”; private … Read more

Precedence order among properties file, YAML file, and Command Line arguments in SpringBoot

Spring Boot property resolution property order is described here. Use of application.properties and application.yaml is not expected. Use one format or the other but not both. Whichever one you use will be handled at position 12 or 13 (depending on whether the file is packaged in the application JAR or not) in property precedence order. … Read more

Spring Boot 2.0 disable default security

According to the new updates in Spring 2.0, if Spring Security is on the classpath, Spring Boot will add @EnableWebSecurity.So adding entries to the application.properties ain’t gonna work (i.e it is no longer customizable that way). For more information visit the official website Security changes in Spring Boot 2.0 Albeit not sure about your requirement … Read more

Spring Security with SOAP web service is working in Tomcat, but not in WebLogic

I just wanted to update the alternate solution I found for this problem, for completeness. Spring Security Filter chain was not working for Weblogic, where as same was working in Tomcat, even for Weblogic version 12.2.1.4. I had followed this example, and implemented Okta filter as spring boot version was not working in Weblogic 12.2.1.4. … Read more

Stop consume message for Stream listener

You can do it using the actuator (see Binding Visualization and Control). Or you can invoke the endpoint programmatically. @SpringBootApplication @EnableBinding(Sink.class) public class So58795176Application { public static void main(String[] args) { SpringApplication.run(So58795176Application.class, args); } @StreamListener(Sink.INPUT) public void listen(String in) { System.out.println(); } @Autowired BindingsEndpoint endpoint; @Bean public ApplicationRunner runner() { return args -> { System.in.read(); … Read more

Can i add topics to my @kafkalistener at runtime

No; the property is evaluated once, during initialization. You cannot add topics to an existing listener container at runtime. You can, however, make your listener bean a prototype bean and create a new container each time you want to listen to new topics. Here’s an example: @SpringBootApplication public class So68744775Application { public static void main(String[] … Read more

Should I explicitly send the Refresh Token to get a new Access Token – JWT

Yes, the refresh token is used to obtain a new access token. When you request the access token for the first time, you usually start by sending a token request to the token endpoint, in case of the so called Resource Owner Password Credentials Grant with user credentials in the request header, e.g. grant_type=password&username=user1&passowrd=very_secret when … Read more