Posts

Showing posts with the label Spring

Are There Any Big Spring-boot Open Source Projects?

Answer : Here are some non pet store but a real world , non trivial , and open source application that use Spring Boot 2. Thingsboard which is an IoT platform with the microservice architecture using Spring Boot 2 Flowable is a business process engines that are based on Spring and have already upgrade to support Spring Boot 2.0 Spring Initializr is the backend web API that can quickly generate a sample spring-boot project. It is exactly the backend API that powered the famous start.spring.io. Kafdrop is the web client that managing Kafka. Built with Spring Boot, Spring MVC, Freemarker etc. Kafkawize is another web client that managing Kafka. Built with Spring Boot, Spring MVC, Spring Security,Spring Data JPA and Thymeleaf etc. The backend of the Corona-Warn-App which is an app that helps trace infection chains of COVID-19 in Germany.Built with Spring Boot, Spring MVC, Spring Security,Spring Data JPA, Bean Validation etc. CloudFoundry User Account and Authentication (UA...

Add Context Path To Spring Boot Application

Answer : Why are you trying to roll your own solution. Spring-boot already supports that. If you don't already have one, add an application.properties file to src\main\resources . In that properties file, add 2 properties: server.contextPath=/mainstay server.port=12378 UPDATE (Spring Boot 2.0) As of Spring Boot 2.0 (due to the support of both Spring MVC and Spring WebFlux) the contextPath has been changed to the following: server.servlet.contextPath=/mainstay You can then remove your configuration for the custom servlet container. If you need to do some post processing on the container you can add a EmbeddedServletContainerCustomizer implementation to your configuration (for instance to add the error pages). Basically the properties inside the application.properties serve as a default you can always override them by using another application.properties next to the artifact you deliver or by adding JVM parameters ( -Dserver.port=6666 ). See also The Reference...

Bootstrap.yml Configuration Not Processed Anymore With Spring Cloud 2020.0

Answer : As pointed put by Nicoll, With Spring Cloud Vault 3.0 and Spring Boot 2.4, the bootstrap context initialization ( bootstrap.yml , bootstrap.properties ) of property sources was deprecated . This can be fixed in one of the 2 ways Use Spring Boot 2.4.0 Config Data API to import configuration from Vault (Preferred) Legacy Processing: Enable the bootstrap context either by setting the configuration property spring.cloud.bootstrap.enabled=true or by including the dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency> 1. Use Spring Boot 2.4.0 Config Data API (Preferred) Move bootstrap.yml configuration to application.yml and updated file looks like below application.yml spring: cloud: vault: authentication: APPROLE app-role: role-id: ${role-id} secret-id: ${secret-id} role: pres-read app-role...

Aspect Not Being Called In Spring Test

Answer : Not sure what you are trying to do but your @ContextConfiguration is useless as you aren't using Spring Test to run your test (that would require a @RunWith or one of the super classes from Spring Test). Next you are adding a singleton which is already fully mocked and configured (that is what the context assumes). I strongly suggest to use Spring instead of working around it. First create a configuration inside your test class for testing, this configuration should do the scanning and register the mocked bean. Second use Spring Test to run your test. @ContextConfiguration public class SoftwareServiceTests extends AbstractJUnit4SpringContextTests { private static final Logger LOGGER = LoggerFactory.getLogger(SoftwareServiceTests.class.getName()); @Autowired private SoftwareService softwareService; @Test(expected = ValidationException.class) public void testAddInvalidSoftware() throws ValidationException { LOGGER.info("Testing a...