Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6909229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:39:47+00:00 2026-05-27T08:39:47+00:00

I have a Spring-Roo project set up using Eclipse link for my JPA persistence

  • 0

I have a Spring-Roo project set up using Eclipse link for my JPA persistence layer and i have created (User Roles, Users ) Table to manage my security. I was wondering if anyone has set up a realm with a Spring project to configure Apache Shiro so that it uses the database tables for username and password look up as well as saves username’s and passwords?

Currently i have a Shiro.ini file being used with a few test roles and (username, password) combinations but i am trying to figure out how to instead configure my web.xml file using the correct filters. Below is my web.xml file and the current filters set.

<filter>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
 <!-- all declarations in shiro.ini file -->
<filter>
    <filter-name>ShiroFilter</filter-name>
    <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
</filter>


<filter-mapping>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>ShiroFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Does anyone have an example of a JDBC realm using (Postgres) with Apache Shiro and Spring?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:39:48+00:00Added an answer on May 27, 2026 at 8:39 am

    Please see Shiro’s Spring documentation for correct web.xml configuration. It is different than the web.xml example you’ve shown.

    Because Spring’s XML config is slightly more powerful than Shiro’s INI, Spring users are encouraged to use full Spring configuration instead of Shiro INI. See the ‘Web Applications’ section of that page to see an example of Spring-only config for Shiro.

    In the ‘applicationContext.xml’ part of that page’s documentation, you’ll see a

    <bean id="myRealm" class="...">
    ...
    </bean>
    

    part of the xml config. Replace that with your JdbcRealm bean definition. You can inject your Spring-configured datasource as expected:

    <bean id="myRealm" class="org.apache.shiro.realm.jdbc.JdbcRealm">
        <property name="dataSource" ref="springConfiguredDataSource"/>
        ...
    </bean>  
    

    You can see the default SQL queries that are run by looking at the JdbcRealm’s source code.

    You can configure those queries as necessary.

    Note that if your data model is complex enough such that the JdbcRealm isn’t sufficient for your needs, it is easy to extend Shiro’s AuthorizingRealm and perform the user/role/permission lookup using whatever datasource API you prefer (JPA, Hibernate, etc.).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just have created a Spring project in STS and shown the view 'Roo Shell'.
I have a maven project I created with spring roo . When I run
I'm using Spring Roo which generated set of hibernate and FlexJSON classes. I have
I have a Spring Roo project and I use mvn jetty:run to run my
I have a maven project that was generated by Spring Roo. Now I am
Using this tutorial https://vaadin.com/springroo , i was able to get a Spring Roo project
I've got a spring roo project and I would like to have the ability
I'm trying to build a spring roo project using hibernate and an oracle database.
I have set up entities and their relationships with Spring Roo. I am trying
I've got my Spring Roo project set up and it's all great, but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.