I received this error when trying to create tables in spring boot
spring.jpa.open-in-view is enabled by default.Therefore database queries may be rendered during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning.
Reading old post here but to no avail
Related
I have a non-web Spring Boot Library which has persistence entities that will be used by web application clients to communicate with the database. When I create my tests, I'm using #SpringBootTest in my spring integration tests, thus simulating a spring boot application using my library.
When setting the spring.h2.console.enabled to true, I thought I would be able to debug through my integration tests and have the H2 console enabled so that I can peer into the data by going to http://localhost:8080/h2-console, but the console doesn't load in my browser.
I have suspicions that this is somehow related to the fact that since my library is not a web-mvc library, it isn't auto configuring the H2 WebServlet, but I would like to know if providing the property would be enough for spring boot to auto configure the servlet.
Does anyone know if providing the H2 property would be enough? Or do I need to do something to enable the H2 WebServlet to be enabled?
I managed to get it working (somewhat) by adding a webEnvironment entry in the #SpringBootTest annotation. This allowed the H2 WebServlet to be registered. The reason that I said "somewhat" was because whenever I debug the test, the thread seems to suspend and I get very delayed response times from H2 when requesting it in my browser (http://localhost:8080/h2-console). My H2 database is very small (500 KB) so I would assume this has something to do with the server being embedded and tied to the test somehow?
I've configured an application with togglz, with the application.properties externalized in a Spring Boot Config server. When I update a feature status on application.properties in the server and make a call to /actuator/refresh they return the feature changes, but the application doesn't change the status of the feature. If I restart the application the status changes.
Does anyone know if it is possible disable a feature without restart application, and didn't use togglz console?
thanks
Disable a feature in a database. If you are using default values: table "togglz" column "feature_enabled"
How to configure Spring Boot Admin to log action. For example, I want Spring Boot Admin log action when someone change log level form INFO to DEBUG or when someone change configuration value in JMX tab and write wrong configure override the existing.
Do Spring Boot Admin has a feature to do that?
No it doesn't but you could write a zuul filter intercepting, analyzing the request to /api/applications/{id}/logfile and writing a log statement.
Spring Boot includes a number of additional features to help you
monitor and manage your application when it’s pushed to production.
You can choose to manage and monitor your application using HTTP
endpoints, with JMX or even by remote shell (SSH or Telnet). Auditing,
health and metrics gathering can be automatically applied to your
application.
Actuator HTTP endpoints are only available with a Spring MVC-based
application. In particular, it will not work with Jersey unless you
enable Spring MVC as well.
You can also activate a listener by invoking the SpringApplication.addListeners(…) method and passing the appropriate Writer object. This method also allows you to customize the file name and path via the Writer constructor.
Customize your requirement in Actuator
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready
Maven :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>1.5.2.RELEASE</version>
</dependency>
http://www.baeldung.com/spring-boot-authentication-audit
when I use spring.session.store-type=jdbc server.session.cookie.path has no effect. But when I implement an own CookieSerializer it works.
When I use spring.session.store-type=none server.session.cookie.path is effective.
Is this a bug?
I assume you use Spring Boot judging by your reference of server.session.cookie.path configuration property - this property is used to configure path of the session cookie when session management is handled by your servlet container (Tomcat by default with Spring Boot).
If you use Spring Session, you're making your session management platform agnostic, meaning your servlet container is not in charge of handling those concerns any more.
This explains the behavior you're seeing - when Spring Session is not used for session management (spring.session.store-type=none) the servlet container session configuration properties (such as server.session.cookie.path) are effective, and when you do use Spring Session (spring.session.store-type=jdbc) they are not.
I've been working with the default database model provided by Spring Security to authenticate users. I've realized that Spring Security looks for these tables in the default schema configured for the database engine.
Now, suppose the following:
You are working with PostgreSQL and you have 2 schema: schemaOne and schemaTwo, where schemaOne is configured as the dafault one for the engine. Then, suppose that you have an application that uses schemaTwo, then you will need Spring Security database model to be in that schema. So, once you try to run your application, Spring Security will try to look for the authentication model in schemaOne.
So, my question is: is there a way to push Spring Security to use a different schema than the default one configured for the database engine?.
Thank you.
Well, you can configure custom JDBC queries, for example:
With XML - override authorities-by-username-query, etc.
With JavaConfig - set authoritiesByUsernameQuery(String), etc.
But, I don't think you can just set the schema name.