How do you get current active/default Environment profile programmatically in Spring?
I need to code different logic based on different current Environment profile. How can you get the currently active and default profiles from Spring? 8 Answers 8
I need to code different logic based on different current Environment profile. How can you get the currently active and default profiles from Spring? 8 Answers 8
I saw spring.jpa.open-in-view=true property in Spring Boot documentation for JPA configuration. Is the true default value for this property if it’s not provided at all?; What does this really do? I did not find any good explaining for it; Does it make you use SessionFactory instead of EntityManagerFactory? If yes, how can I tell it … Read more
Is there any difference between using an id attribute and name attribute on a <bean> element in a Spring configuration file? 6 Answers 6
What are the pros and cons of using @Autowired in a class that will be wired up by Spring? Just to clarify, I’m talking specifically about the @Autowired annotation, not auto-wiring in XML. I probably just don’t understand it, but to me it almost seems like an anti-pattern – your classes start to become aware … Read more
I’m new to frameworks (just passed the class) and this is my first time using Spring Boot. I’m trying to run a simple Junit test to see if my CrudRepositories are indeed working. The error I keep getting is: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test java.lang.IllegalStateException … Read more
I get this error when trying to invoke “persist” method to save entity model to database in my Spring MVC web application. Can’t really find any post or page in internet that can relate to this particular error. It seems like something’s wrong with EntityManagerFactory bean but i’m fairly new to Spring programming so for … Read more
I have 5 environments: – local (my development machine) – dev – qc – uat – live – staging I want different application properties to be used for each environment, so I have the following properties files each which have a different URL for the datasource: – application.properties (containing common properties) – application-local.properties – application-dev.properties … Read more
I have two questions: How to map a list of JSON objects using Spring RestTemplate. How to map nested JSON objects. I am trying to consume https://bitpay.com/api/rates, by following the tutorial from http://spring.io/guides/gs/consuming-rest/. 15 Answers 15
Is there a way to statically/globally request a copy of the ApplicationContext in a Spring application? Assuming the main class starts up and initializes the application context, does it need to pass that down through the call stack to any classes that need it, or is there a way for a class to ask for … Read more
I was working on my Spring boot app project and noticed that, sometimes there is a connection time out error to my Database on another server(SQL Server). This happens specially when I try to do some script migration with FlyWay but it works after several tries. Then I noticed that I didn’t specify spring.jpa.hibernate.ddl-auto in … Read more