How to add hibernate mapping file to Spring boot configuration? - java

I'm trying to move a huge query to the external file (xml). I'm using Spring boot with Spring Data JPA. It was easy with persistence.xml, but I have only application.properties here.
Is there a easy way to do this?
I created orm.xml, added query there, but it looks like Spring Boot is not recognizing it.

Related

Tuning couchbase using spring boot properties

Does anyone know what should be correct spring boot properties to fine tune queryService in couchbase client. I am using spring-boot-starter-data-couchbase-reactive which uses couchbase-java-client 2.5.9 and couchbase-core-io 1.5.9
I am trying below properties but it is not working.
spring.couchbase.env.endpoints.queryservice.min-endpoints=5
spring.couchbase.env.endpoints.queryservice.max-endpoints=10
spring.couchbase.env.autorelease-after=5000
I can extend AbstractCouchbaseConfiguration to override properties but I would like to know if it is possible using spring boot properties.

IntelliJ Hibernate facet without hibernate.cfg.xml?

I am using Spring Boot Data JPA for my project and would like to add the Hibernate facet. However, this seems to require the use of hibernate.cfg.xml to use for the path property in the facet to work. This completely defeats the purpose of Spring Boot and the auto configury shenanigans it provides. My workaround is to use the JPA facet with Hibernate as the default provider, but I would like to use the Hibernate facet instead. Any help is appreciated.

Workaround to using #ImportResource for XML config files

I am developing an application that runs on Spring Boot configured via XML. For modularity, I didn't want to use #ImportResource as it requires me to go into the source code when in XML configuration I can just configure the XML files to change dependencies.
The problem is that I'm using Spring Boot to run my Spring MVC Controllers (#Controller) and for me to make use of the dependencies I configured in my XML files, I need to declare #ImportResource, which I don't want to use.
Is there any workaround to not use #ImportResource while still using XML config files to inject the dependencies in my Spring MVC Controllers?
If you are using spring boot and you are ok with mentioning the config location in application properties, you can do this in application.properties
config:
location: file:///config.xml
And the you can use this property in your #ImportResource
#ImportResource("${config.location}")
This way you can avoid changes to the source code, while still using xml configuration.

yaml configuration in spring mvc (But not using spring-boot)

Is there a way to enable yaml configuration (instead of properties file) in normal spring web mvc application without using spring boot and have the #Value annotation supported.
I searched a lot, everywhere it uses spring boot. I am not intrested to use spring boot, as its very heavy and have many dependancies configured for auto setup.
Any help would be appreciated......

Properly (and easily ?) initiate a Spring MVC Project

What's the best method to initiate a new Spring Project ?
Initiating Spring project is a lot of pain with various xml and db configuration.
Is there an "official" repository with complete sample project, as MVC with db access and so ?
Spring Boot may also be the solution, but some point still not clear to me :
How to add external components (such as Quartz) without creating some xml config ? (No such xml in Boot apparently)
Is a Spring Boot builded app is production-proof ?
As writen in the comments http://start.spring.io/ is the best way to start Spring boot project(STS has integration for it).
If you want to use something that is not supported by Spring Boot you can init spring beans the same way you do it in xml, just use java configuration. See this for example: http://www.tutorialspoint.com/spring/spring_java_based_configuration.htm
Also useing xml is still available. You can add #ImportResource on your Configuration class
#EnableAutoConfiguration
#Configuration
#ImportResource({"classpath*:applicationContext.xml"})

Categories